def lc.tab.get

bend-osdev-cipher-core@0.1.0.0 · cipher_core.bend:284

import bend-osdev-cipher-core@0.1.0.0/cipher_core.bend as CipherCore
import Base

284# entry i of a table of depth d (i below 2^d)
285def lc.tab.get(d: Nat, t: LcTab, +i: U32) -> U32:
286  match d:
287    case 0n:
288      match t:
289        case LcLeaf{v}:
290          v
291        case LcNode{l, r}:
292          0
293    case 1n+(+p):
294      match t:
295        case LcLeaf{v}:
296          v
297        case LcNode{l, r}:
298          lc.tab.get(p, lc.tab.pick(U32.is_eq(lc.bit(i, p), 1), l, r), i)

Uses (6)

Used by (5)