Skip to content

Glossary: Algorithms Beyond the Basics in Rust

Power of two

Also written: powers of two

A number such as 1, 2, 4, 8 that has exactly one 1 bit. `n & (n - 1) == 0` is true for positive powers of two, and each flag in a bitmask uses one.

Where the book teaches it

Related terms

Bitmask / flagBit operators