uint64_t i64_BitMask = (uint64_t) (1 << 33) - 1 ;
int a = (i64_BitMask >> 32);
printf ("BitMask %x\n", a);
This produces ffffffff. I'm pretty sure, watching the stages in
debugging, that 1 << 33 is resolving to zero, since it's being shifted
off the MSB of a 32 bit integer.
I am in general having problems with uint64_t with GCC. In particular,
I can't send one to printf and get a sensible output. The shift
operators appear to only work with 32-bit integers. Also, if I have
intermediate steps, it always seems to want to truncate the output to
32-bits. Putting in casts to uint64_t sometimes fixes it, but not
always. What do I do?
(using XCode, Apple's stdint.h)