def shift

lawful-bytes@0.1.1.0 · bytes.bend:161

import lawful-bytes@0.1.1.0/bytes.bend as Bytes
import Base
import lawful-bytes@0.1.1.0/defs.bend as D

161# The first k bytes dropped, the rest moved to the start (for k <= len).
162def shift(b: D.Bytes, +k: U32) -> D.Bytes:
163  D.Bytes{+n, buf} = b
164  truncate(shift.go(Nat.sub(U32.to_nat(n), U32.to_nat(k)), at(D.Bytes{n, buf}, k), 0, k), (n - k : U32))

Uses (8)

Used by (6)