def cr.oct.pieces.go

bend-osdev-crypto@0.1.0.0 · octets.bend:76

import bend-osdev-crypto@0.1.0.0/octets.bend as Octets
import Base

76# the pieces of xs, last first: whole n-byte pieces, then what is left
77# (cur: the piece being filled, reversed, i bytes long)
78def cr.oct.pieces.go(xs: List<&2, U32>, +n: Nat, +i: Nat, +cur: List<&2, U32>, acc: List<&2, List<&2, U32>>) -> List<&2, List<&2, U32>>:
79  match xs:
80    case Nil{}:
81      cr.oct.flush(cur, acc)
82    case Con{x, t}:
83      +c : List<&2, U32> = Con{x, cur}
84      +full = Nat.is_eq(1n+i, n)
85      cr.oct.pieces.go(t, n, cr.oct.pieces.i(full, 1n+i), cr.oct.pieces.cur(full, c), cr.oct.pieces.step(full, c, acc))

Uses (8)

Used by (1)