def stream.compress
mylsm-lsm-store@0.6.0.1 · src/hub_sha/sha256.bend:257
import mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend as Sha256
import Base
import mylsm-lsm-store@0.6.0.1/src/hub_sha/state.bend as S
import bend-kit-bytes@0.3.2.0/bytes.bend as Packed
257def stream.compress(bytes: Packed.Bytes, compressed: S.State) -> S.State:
258 match bytes:
259 case Packed.Bytes{+len, buf}:
260 stream.count(packed.blocks(
261 Nat.mul(Nat.div(U32.to_nat(len), 64n), 16n), 16n,
262 Packed.Cursor.u32be(Packed.Cursor.new(Packed.Bytes{len, buf})),
263 Nil{}, compressed))