Skip to content

Glossary: Algorithms Beyond the Basics in Go

Shift left / shift right

Also written: <<, >>, shift

`a << n` moves bits left, doubling the number n times, and `a >> n` moves them right, halving it. `1 << n` is 2ⁿ.

Where the book teaches it

Related terms

Bit operatorsBitmask