Chapter 3. Power-of-2 Boundaries

Rounding Up/Down to a Multiple of a Known Power of 2

Rounding Up/Down to the Next Power of 2

Detecting a Power-of-2 Boundary Crossing