def pt_cells

bendtorch@1.3.0.0 · main.bend:3346

import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base

3346# the number of cells a tree takes (the tree comes back)
3347def pt_cells(t: PTree) -> PTU:
3348  match t:
3349    case PNew{v16}: PTU{PNew{v16}, 2}
3350    case PLeaf{+n, m, v}: PTU{PLeaf{n, m, v}, (2 + (2 * ph_hw(n) : U32) : U32)}
3351    case PLeafV{+n, m, v}: PTU{PLeafV{n, m, v}, ((2 + ph_hw(n) : U32) + n : U32)}
3352    # bend-lint: disable-next bend-lint-rules/performance/missed_fork -- a tree of one node per layer, walked once per checkpoint not-expected-because: a fork costs more than the walk
3353    case PNode{a, b}: ptu_node(pt_cells(a), pt_cells(b))

Uses (7)

Used by (2)