I have the following sample code:
uint64_t x, y;
x = ~(0xF<<24);
y = ~(0xFF<<24);
The result would be:
x=0xffff
Other posters have shown why it does this. But to get the expected results:
uint64_t x, y;
x = ~(0xFULL<<24);
y = ~(0xFFULL<<24);
Or you can do this (I don't know if this is is any slower than the above though):
uint64_t x, y;
x = ~(uint64_t(0xF)<<24);
y = ~(uint64_t(0xFF)<<24);
Then:
x = 0xfffffffff0ffffff
y = 0xffffffff00ffffff