def inflate.length.repeat
gralha-bytes@0.1.0.1 · bytes.bend:303
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
303def inflate.length.repeat(read: BitRead, +base: U32, +value: U32, +remaining: U32, +lengths: Bytes) -> Inflate:
304 BitRead{extra, stream} = read
305 +count = (base + extra : U32)
306 +input = stream
307 U.branch(Inflate, bits.valid(input) && U32.is_le(count, remaining), _ => Inflate{input, bytes.repeat(U32.to_nat(count), value, lengths)}, _ => Inflate{bits.invalid(input), lengths})