Andrew's Digital Garden

Bitwise operators

>>and << are shift operators. They are common across languages such as C, PHP, and [[go]].

Go in particular makes the operation slightly safer, but the simplified version is that shift all bits of a number left/right, by the amount given.

<< is 'times 2', and>> is 'divided by 2', x amount of times.

For example, 1 << 4 is 1 times 2, 4times. Which is 16.

[[concepts]] [[shell]]

Bitwise operators