all-ones-check-idiom

Status: IN

`(m & (m + 1)) == 0` tests whether `m` is zero or all-ones up to the MSB — the complement of the `n & (n-1) == 0` power-of-two check, reusable across bit-manipulation problems.

Source: entries/2026/06/06/binary-number-with-alternating-bits-solution.md

JSON