How do I bit shift a long by more than 32 bits?
Posted
by mach7
on Stack Overflow
See other posts from Stack Overflow
or by mach7
Published on 2010-03-08T20:20:06Z
Indexed on
2010/03/08
20:21 UTC
Read the original article
Hit count: 172
It seems like I should be able to perform bit shift in C/C++ by more than 32 bits provided the left operand of the shift is a long. But this doesn't seem to work, at least with the g++ compiler.
Example:
unsigned long A = (1L << 37)
gives
A = 0
which isn't what I want. Am I missing something or is this just not possible?
-J
© Stack Overflow or respective owner