Right Shift
The >> operator
- takes a single value (1,2,4,8 bytes), treats as sequence of bits
- and a small positive integer x
- moves (shifts) each bit x positions to the right
- right-end bit vanishes; left-end bit replaced by zero**
- result contains same number of bits as input
Example:
00100111 >> 2 00100111 >> 8
-------- --------
00001001 00000000
|
** if signed quantity, sign bit replaces left-end bit
|