def set_if

mylsm-lsm-store@0.6.0.1 · src/BitTree.bend:172

import mylsm-lsm-store@0.6.0.1/src/BitTree.bend as BitTree
import Base
import 0x9ee2e9a299991dcc089fe22c7f3ceb5f/src/containers/bitset.bend as BitWords

172# Update if for the packed bit-tree operations.
173def set_if(inside: Bool, +tree: BitTree, +bit: Nat) -> BitTree:
174  match inside:
175    case False{}:
176      tree
177    case True{}:
178      +index = Nat.div(bit, 32n)
179      +old = word_at(tree, index)
180      replace_word(tree, index, BitWords.word_put(True{}, old, Nat.mod(bit, 32n)))

Uses (7)

Used by (1)