I'm learning about the C language. I have this code, more can be provided if needed:
int result = 0;
int mask1 = 0x0000ffff;
mask1 = mask1 >> 28;
This when I use gdb and print /x mask1
, I get 0x0
, which is correct.
Then why does:
int result = 0;
int mask1 = 0xffffffff;
mask1 = mask1 >> 28;
print 0xffffffff
shouldn't it be printing 0x0000000f
, since I'm left shifting 28 bits?
Does it have to do with the number of bits int takes up on my 64bit machine? I looked at this but it didn't quite answer everything.