def u32_bc_go

bend-collections-laws-math@1.0.0.0 · src/math/fixed.bend:206

import bend-collections-laws-math@1.0.0.0/src/math/fixed.bend as Fixed
import Base

206# the 1 bits of the k low nibbles of x, a nibble at a time
207def u32_bc_go(fuel: Nat, +x: U32) -> Nat:
208  match fuel:
209    case 0n:
210      0n
211    case 1n+k:
212      Nat.add(ones4(U32.to_nat(U32.mod(x, 16))), u32_bc_go(k, U32.shrn(x, 4n)))

Uses (7)

Used by (2)