def U32Nat.half
import bend-osdev-u32@0.1.0.0/u32.bend as U32import Base
32# n / 2, rounded down
33def U32Nat.half(n: Nat) -> Nat:
34 match n:
35 case 0n:
36 0n
37 case 1n+p:
38 match p:
39 case 0n:
40 0n
41 case 1n+q:
42 1n+U32Nat.half(q)