Bendtorch.pt_cells: def of bendtorch@1.3.0.0 Import: import bendtorch@1.3.0.0/main.bend as Bendtorch Lines 3346-3353 of bendtorch@1.3.0.0/main.bend: https://jend.leeeet.dev/read.txt?path=bendtorch@1.3.0.0/main.bend&start_line=3346&end_line=3353 import Base # the number of cells a tree takes (the tree comes back) def pt_cells(t: PTree) -> PTU: match t: case PNew{v16}: PTU{PNew{v16}, 2} case PLeaf{+n, m, v}: PTU{PLeaf{n, m, v}, (2 + (2 * ph_hw(n) : U32) : U32)} case PLeafV{+n, m, v}: PTU{PLeafV{n, m, v}, ((2 + ph_hw(n) : U32) + n : U32)} # 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 case PNode{a, b}: ptu_node(pt_cells(a), pt_cells(b)) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=PTU https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=PTree https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ph_hw https://jend.leeeet.dev/definition.txt?path=bendtorch@1.3.0.0/main.bend&name=ptu_node