def ctz_go
import bend-collections@1.0.0.0/src/math/f64.bend as F64import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
import bend-collections@1.0.0.0/src/math/w64.bend as X
1198# trailing zeros of w (at most fuel), one halving at a time
1199def ctz_go(fuel: Nat, +w: W.U64, odd: Bool) -> Nat:
1200 match fuel odd:
1201 case 0n _:
1202 0n
1203 case 1n+f True{}:
1204 0n
1205 case 1n+f False{}:
1206 1n+ctz_go(f, X.half(w), X.odd(X.half(w)))