I need to write a repeating pattern to memory (e.g. 0x11223344), so that the whole memory looks like (in hex):
1122334411223344112233441122334411223344112233441122334411223344...
I can’t figure out how to do it with memset() because it takes only a single byte, not 4 bytes.
Any ideas?
An efficient way would be to cast the pointer to a pointer of the needed size in bytes (e.g.
uint32_tfor 4 bytes) and fill with integers. It’s a little ugly though.Not tested!