def bits_go

bend-collections@1.0.0.0 · src/containers/bitlist.bend:240

import bend-collections@1.0.0.0/src/containers/bitlist.bend as Bitlist
import Base
import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as D

240# The first n bits, emitted from the last stored word down to word 0.
241def bits_go(k: Nat, st: D.DynArray<&2, U32> & List<&2, Bool>, +n: Nat) -> D.DynArray<&2, U32> & List<&2, Bool>:
242  match k:
243    case 0n:
244      st
245    case 1n+ +q:
246      (w, acc) = st
247      bits_go(q, bits_add(Nat.min(32n, Nat.sub(n, Nat.mul(q, 32n))), acc, D.get(U32, w, q)), n)

Uses (12)

Used by (1)