def is_pow2

bend-collections-laws-math@1.0.0.0 · src/math/random/rand.bend:95

import bend-collections-laws-math@1.0.0.0/src/math/random/rand.bend as Rand
import Base
import bend-collections-laws-math@1.0.0.0/src/math/u64.bend as W
import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X

95# n & (n - 1) == 0: n is a power of two (or zero)
96def is_pow2(+n: W.U64) -> Bool:
97  X.is_zero(and64(n, X.sub(n, W.U64{1, 0})))

Uses (5)

Used by (3)