def encode.last

bend-kit-http2@0.4.0.0 · huffman.bend:1192

import bend-kit-http2@0.4.0.0/huffman.bend as Huffman
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

1192def encode.last(more: Bool, out: Bytes.Bytes, +at: U32, +partial: U32, +bits: U32) -> Bytes.Bytes:
1193  match more:
1194    case False{}:
1195      out
1196    case True{}:
1197      +pad = (8 - bits : U32)
1198      Bytes.set(out, at, ((partial << U32.to_nat(pad)) .|. ((1 << U32.to_nat(pad)) - 1 : U32) : U32))

Uses (8)

Used by (1)