| Bitshift operators | |||||||||||||||
| x << n | Shift bits of x left by n digits | ||||||||||||||
| Insert 0's on the right | |||||||||||||||
| x >> n | Shift bits of x right by n digits | ||||||||||||||
| If unsigned or non-negative, insert 0's on left | |||||||||||||||
| If signed, may be system dependent | |||||||||||||||
| Important: x DOES NOT CHANGE! | |||||||||||||||
| (just like x + 2 does not change x) | |||||||||||||||
| x <<= n |
|
change x | |||||||||||||
| x >>= n | |||||||||||||||
| x and n must be int | |||||||||||||||