I’m currently playing around with bit manipulation in C, and I’m noticing that the right shift operator is not behaving as I anticipated. From what I understand, left shifts leave 0s behind as it shifts form the LSB, and right shifts leave 1s as it shifts from the MSB.
So I tried making a simple bit mask that looks like this:
110000
By creating an int 32>>1
.
When I type in 32>>1
, I don’t get 48 as expected, I get 16. Why?