From following code I expect to set all bits in x to 1, but somehow only first 32 bits are set:
int64_t x = 0xFFFFFFFF;
x<<32;
x|=0xFFFFFFFF;
Note: printing x after each line results in 4294967295 (32 lower bits set to 1).
Also, tried using numeric_limits<int64_t>::min()
with no success.
My question is how to set all bits in x?
Using RHEL5.5.
Thx
x<<32
calculates the result of shifting x
left by 32 bits and does nothing with the value. You want to use x <<= 32
instead.
Why not int64_t x = -1
? or uint64_t x = ~0
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With