def tz

bend-collections-laws-math@1.0.0.0 · spec/math/f64.bend:565

import bend-collections-laws-math@1.0.0.0/spec/math/f64.bend as F64
import Base

565# trailing zero bits of n (at most fuel)
566def tz(fuel: Nat, +n: Nat) -> Nat:
567  match fuel:
568    case 0n:
569      0n
570    case 1n+f:
571      pick(Nat, Nat.is_eq(Nat.mod(n, 2n), 1n), 0n, 1n+tz(f, Nat.div(n, 2n)))

Uses (5)

Used by (5)