def Int.bits.go
import bend-kit-int@0.2.0.0/int.bend as Intimport Base
4# The Int.* core serves only U64 and I64. When Base ships a native U64 (bendlang/bend#1027), delete it.
5def Int.bits.go(n: Nat, qr: Nat & Nat) -> Word(n):
6 match n:
7 case 0n:
8 WNil{}
9 case 1n+p:
10 (q, r) = qr
11 WCon{Nat.is_eq(r, 1n), Int.bits.go(p, Nat.divmod(q, 2n))}