def huff.fixed.lengths

gralha-bytes@0.1.0.1 · bytes.bend:200

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

200def huff.fixed.lengths(n: Nat, +index: U32, out: Bytes) -> Bytes:
201  match n:
202    case 0n: out
203    case 1n+d: huff.fixed.lengths(d, U32.inc(index), bytes.push(out, U.choose(U32, U32.is_lt(index, 144), 8, U.choose(U32, U32.is_lt(index, 256), 9, U.choose(U32, U32.is_lt(index, 280), 7, 8)))))

Uses (7)

Used by (1)