2011/5/22 Aleksey Bragin aleksey@reactos.org:
Fantastic, so I suppose whenever I want my double word variable to have a value of, say, 0x54 taking your friendly reminder about 8 hex digits into account, I would need to write 0x54545454 because, you know, I need 8 hex digits for 32-bit numbers and need to add some random stuff to fill it up to 8 digits :)
You can use something like this, though it's less self-descriptive:
#include <stdio.h> typedef unsigned int DWORD; #define DUP4BYTES(c) ((DWORD)(c) | (DWORD)(c) << 8 | (DWORD)(c) << 16 | (DWORD)(c) << 24)
int main() { unsigned int x = DUP4BYTES(0x54); printf("x = %08x\n", x);
return 0; }
GCC is smart enough to produce "movl $0x54545454,-0x4(%rbp)" in its output.