def lc.tab.get
import bend-osdev-legacy-ciphers@0.1.0.0/legacy_ciphers.bend as LegacyCiphersimport Base
287# entry i of a table of depth d (i below 2^d)
288def lc.tab.get(d: Nat, t: LcTab, +i: U32) -> U32:
289 match d:
290 case 0n:
291 match t:
292 case LcLeaf{v}:
293 v
294 case LcNode{l, r}:
295 0
296 case 1n+(+p):
297 match t:
298 case LcLeaf{v}:
299 v
300 case LcNode{l, r}:
301 lc.tab.get(p, lc.tab.pick(U32.is_eq(lc.bit(i, p), 1), l, r), i)