Truncates the binary representation of the correct operand.
From the documentation for Bitwise shift operators :
The shift operators convert their operands to 32-bit integers in orthogonal order and return the result of the same type as the left operand. The correct operand must be less than 32, but if not only low five bits will be used.
So in your example 32 there is 0b100000 . Since it takes only the least significant five bits, you are left with 0b00000 , so it shifts the number by 0 . Again, 33 is 0b100001 , and the lower five bits are 0b00001 , so it shifts the number by 1 . And so on.
Herohtar
source share