def bitlen

bend-collections-laws-math@1.0.0.0 · src/math/w64.bend:224

import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as W64
import Base

224# the number of bits of x (0 for 0), by a binary search on the top bit
225def bitlen(+x: U32) -> Nat:
226  bl_fin(bl_step(1n, bl_step(2n, bl_step(4n, bl_step(8n, bl_step(16n, (0n, x)))))))

Uses (5)

Used by (15)