Expressions And Operators: Bitwise Left Shift
The binary operator
<< works as follows: Given the expression
e1 << e2, the bits in the value of
e1 are shifted left by
positions. Bits shifted off the left end are discarded, and zero-valued bits are shifted on from the right end.
both have type
int. The type of the result is
int, and the value of the result is that after the shifting is complete. The values
e2 are unchanged.
0b101 << 2 // result is 0b10100