def depth.go

ezx@1.11.0.0 · src/share/sha.bend:32

import ezx@1.11.0.0/src/share/sha.bend as Sha
import Base

32# the depth of an array whose capacity, 2^depth, is at least `words`
33def depth.go(bits: Nat, +words: Nat, +cap: Nat, +acc: Nat) -> Nat:
34  match bits:
35    case 0n:
36      acc
37    case 1n+p:
38      depth.step(Nat.is_lt(cap, words), acc,
39        _u => depth.go(p, words, Nat.mul(cap, 2n), Nat.add(acc, 1n)))

Uses (5)

Used by (1)