Saturday, 14 September 2013

Shifting a 32 bit integer by 32 bits

Shifting a 32 bit integer by 32 bits

I'm slinging some C code and I need to bitshift a 32 bit int left 32 bits.
When I run this code with the parameter n = 0, the shifting doesn't
happen.
int x = 0xFFFFFFFF;
int y = x << (32 - n);
Why doesn't this work?

No comments:

Post a Comment