def inflate.trees
gralha-bytes@0.1.0.1 · bytes.bend:327
import gralha-bytes@0.1.0.1/bytes.bend as Bytes
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
327def inflate.trees(result: Inflate, +litCount: U32, distCount: U32) -> DeflateTrees:
328 Inflate{stream, lengths} = result
329 +ls = lengths
330 +input = stream
331 DeflateTrees{huff.build(bytes.slice(U32.to_nat(litCount), ls, 0, bytes.empty())), huff.build(bytes.slice(U32.to_nat(distCount), ls, litCount, bytes.empty())), U.choose(BitStream, U32.is_gt(bytes.get(ls, 256), 0), input, bits.invalid(input))}