gcc
bitwise Leftshift (<<
) strange behavior. Here is my code:
#include
#include
void foo(in
Don't be surprised. you're dealing with a 32bit int, so when you do 1<<32, you've shifted that set bit right off the end of the int and zeroed out the whole thing.
e.g. in binary:
33222222 22211111 11111000 00000000
10987654 32109876 54321098 76543210
1: 00000000 00000000 00000000 00000001
^--- position #32