src/inflate.bend checks
raw source on the hub · import 0x57618559b9b26dd8415f821176a3e692/src/inflate.bend as Inflate
src/inflate: zlib-wrapped DEFLATE for a PNG IDAT stream (compression method 0). Blocks are stored, fixed Huffman, or dynamic Huffman.
1 import
import Base
Types
type Ph source · line 6 · raw
Data
where the bit reader is
PBytePh
PAlignPh
PSymPh
PDonePh
PFailPh
type Md source · line 14 · raw
Data
which integer the bit reader is filling
MCmfMd
MFlgMd
MBlkMd
MLenMd
MNlenMd
MDataMd
MHlitMd
MHdistMd
MHclenMd
MClenMd
MXlenMd
MXdistMd
MAdlerMd
MRepMd
type Wh source · line 31 · raw
Data
which Huffman table a symbol is read from
WLitWh
WDistWh
WClenWh
type St source · line 37 · raw
Data
one inflate reader: phase, tables, and the bytes emitted newest-first
St@ph:Ph -> @md:Md -> @wh:Wh -> @+acc:U32 -> @+got:U32 -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+hacc:U32 -> @+hlen:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
type lens.Split source · line 313 · raw
Data
the two halves of a code-length list
lens.Split@lo:List<&2, U32> -> @hi:List<&2, U32> -> lens.Split
Definitions
def st.make source · line 43 · raw
@ph:Ph -> @md:Md -> @wh:Wh -> @+acc:U32 -> @+got:U32 -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+hacc:U32 -> @+hlen:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
build a reader
def st.fail source · line 74 · raw
St
a reader that has failed
def st.empty source · line 78 · raw
St
the reader before the first byte
def st.gate source · line 82 · raw
@zz:Bool -> @aa:St -> @bb:St -> St
pick a reader
def huff.zeros source · line 93 · raw
@nn:Nat -> List<&2, U32>
sixteen zeros, or nineteen: a code-length histogram
def huff.at.put source · line 101 · raw
@+hh:U32 -> @+rest:U32 -> @zz:Bool -> U32
the value at an index, or zero past the end
def huff.at source · line 109 · raw
@xs:List<&2, U32> -> @+ii:U32 -> U32
the value at an index
def huff.set source · line 117 · raw
@xs:List<&2, U32> -> @zz:Bool -> @+ii:U32 -> @+vv:U32 -> List<&2, U32>
write an index. The Bool is "this is the slot".
def huff.bump source · line 127 · raw
@+acc:List<&2, U32> -> @+L:U32 -> @zz:Bool -> List<&2, U32>
count a nonzero length
def huff.count source · line 135 · raw
@ls:List<&2, U32> -> @acc:List<&2, U32> -> List<&2, U32>
bl_count, index is the length. Zeros are not counted.
def huff.next source · line 143 · raw
@counts:List<&2, U32> -> @+code:U32 -> @+prev:U32 -> @acc:List<&2, U32> -> List<&2, U32>
next_code, built newest-first
def huff.nexts source · line 152 · raw
@counts:List<&2, U32> -> List<&2, U32>
next_code[0] is zero, then one slot per length from 1
def huff.pack source · line 160 · raw
@+len:U32 -> @+code:U32 -> @+sym:U32 -> U32
pack length, canonical code, and symbol into one word
def huff.sym source · line 164 · raw
@+ee:U32 -> U32
the symbol in a packed entry
def huff.code source · line 168 · raw
@+ee:U32 -> U32
the code in a packed entry
def huff.len source · line 172 · raw
@+ee:U32 -> U32
the length in a packed entry
def huff.hit source · line 176 · raw
@+ee:U32 -> @+code:U32 -> @+len:U32 -> Bool
does this entry match the bits read so far?
def huff.find.put source · line 180 · raw
@+sym:U32 -> @rest:Maybe<&2, U32> -> @hit:Bool -> Maybe<&2, U32>
keep the symbol when the entry matches
def huff.find source · line 188 · raw
@tab:List<&2, U32> -> @+code:U32 -> @+len:U32 -> Maybe<&2, U32>
the symbol whose canonical code is these bits
def huff.keep source · line 196 · raw
@acc:List<&2, U32> -> @+sym:U32 -> @+len:U32 -> @+code:U32 -> @zz:Bool -> List<&2, U32>
cons a packed entry when the length is not zero
def huff.step source · line 204 · raw
@+nexts:List<&2, U32> -> @+len:U32 -> @zz:Bool -> List<&2, U32>
advance next_code at this length when it was used
def huff.assign source · line 212 · raw
@ls:List<&2, U32> -> @+sym:U32 -> @+nexts:List<&2, U32> -> @acc:List<&2, U32> -> List<&2, U32>
assign canonical codes in symbol order
def huff.canon source · line 221 · raw
@+ls:List<&2, U32> -> List<&2, U32>
canonical Huffman table from a length per symbol
def lit.len2 source · line 225 · raw
@cc:Bool -> U32
fixed literal/length code length at a symbol
def lit.len1 source · line 233 · raw
@bb:Bool -> @cc:Bool -> U32
fixed literal/length code length, past 143
def lit.len source · line 241 · raw
@+_s:U32 -> @aa:Bool -> @bb:Bool -> @cc:Bool -> U32
fixed literal/length code length
def lit.lens source · line 249 · raw
@ii:Nat -> @acc:List<&2, U32> -> List<&2, U32>
lengths 0..i, oldest first once i runs down to zero
def lit.fixed source · line 258 · raw
List<&2, U32>
the fixed literal/length table
def dist.lens source · line 262 · raw
@nn:Nat -> List<&2, U32>
thirty-two distance lengths of 5
def dist.fixed source · line 270 · raw
List<&2, U32>
the fixed distance table
def len.base source · line 274 · raw
List<&2, U32>
length bases for symbols 257..285
def len.extra source · line 278 · raw
List<&2, U32>
extra bits for symbols 257..285
def dist.base source · line 282 · raw
List<&2, U32>
distance bases
def dist.extra source · line 287 · raw
List<&2, U32>
extra bits for distances
def clen.order source · line 291 · raw
List<&2, U32>
code-length symbol order
def clen.place source · line 295 · raw
@order:List<&2, U32> -> @lens:List<&2, U32> -> @acc:List<&2, U32> -> List<&2, U32>
drop code-length values into the 19 symbol slots
def lens.rep source · line 305 · raw
@kk:Nat -> @+vv:U32 -> @lens:List<&2, U32> -> List<&2, U32>
repeat a length n times onto the front of the list
def lens.split source · line 317 · raw
@xs:List<&2, U32> -> @zz:Bool -> @+nn:U32 -> @acc:List<&2, U32> -> Maybe<&2, lens.Split>
split a list after n elements. The Bool is "n is zero".
def bits.push source · line 330 · raw
@ii:Nat -> @+bb:U32 -> @acc:List<&2, U32> -> List<&2, U32>
eight bits of a byte, low bit at the head
def bits.rows source · line 338 · raw
@xs:List<&2, U32> -> List<&2, List<&2, U32>>
one bit list per byte
def bits.of source · line 346 · raw
@xs:List<&2, U32> -> List<&2, U32>
the bit stream, low bit of each byte first
def adler.go source · line 350 · raw
@xs:List<&2, U32> -> @+aa:U32 -> @+bb:U32 -> Pair(U32, U32)
Adler-32, one byte at a time
def adler.fin source · line 360 · raw
@pp:Pair(U32, U32) -> U32
pack the two Adler sums
def adler.of source · line 366 · raw
@xs:List<&2, U32> -> U32
Adler-32 of chronological bytes
def copy.nth.put source · line 370 · raw
@+hh:U32 -> @rest:Maybe<&2, U32> -> @zz:Bool -> Maybe<&2, U32>
the byte i from the head
def copy.nth source · line 378 · raw
@xs:List<&2, U32> -> @+ii:U32 -> Maybe<&2, U32>
the byte i from the head, or none
def copy.run source · line 386 · raw
@nn:Nat -> @mm:Maybe<&2, U32> -> @+dist:U32 -> @+out:List<&2, U32> -> Maybe<&2, List<&2, U32>>
copy n bytes from dist back. m is the next byte, already read.
def copy.start source · line 397 · raw
@+len:U32 -> @+dist:U32 -> @+out:List<&2, U32> -> Maybe<&2, List<&2, U32>>
copy len bytes from dist back into a newest-first buffer
def rd.begin source · line 404 · raw
@md:Md -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
start the field md asks for, now that the stream is aligned
def rd.align source · line 436 · raw
@zz:Bool -> @md:Md -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a byte-aligned field starts, or a padding bit is still waiting
def rd.to_align source · line 466 · raw
@md:Md -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
skip bits up to the next byte, then read md
def rd.byte source · line 491 · raw
@md:Md -> @wh:Wh -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a fresh integer field of need bits
def rd.after source · line 517 · raw
@final:Bool -> @wh:Wh -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
the next block, or the Adler checksum when this was the last block
def rd.sym source · line 546 · raw
@wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
literal/length or distance symbols
def rd.tree source · line 570 · raw
@wh:Wh -> @+lit:List<&2, U32> -> @+dts:List<&2, U32> -> @+clen:List<&2, U32> -> List<&2, U32>
the table a symbol is drawn from
def rd.cmf source · line 580 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
CMF: method 8, window at most 32K
def rd.flg source · line 605 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
FLG: the header check, and no preset dictionary
def rd.blk.dyn source · line 632 · raw
@final:Bool -> @z2:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
dynamic header, or a reserved block type
def rd.blk.huff source · line 658 · raw
@final:Bool -> @z1:Bool -> @z2:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
fixed or dynamic Huffman
def rd.blk.go source · line 685 · raw
@final:Bool -> @z0:Bool -> @z1:Bool -> @z2:Bool -> @wh:Wh -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
dispatch on the block type
def rd.blk.at source · line 716 · raw
@+finb:U32 -> @+bt:U32 -> @wh:Wh -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
BFINAL is the low bit. BTYPE is the next two.
def rd.blk source · line 741 · raw
@+val:U32 -> @wh:Wh -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a stored block, a fixed block, or a dynamic block
def rd.len source · line 765 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
stored LEN, then NLEN
def rd.nlen.ok source · line 789 · raw
@zz:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
an empty stored block ends the block; otherwise the bytes follow
def rd.nlen source · line 818 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
NLEN is the one's complement of LEN
def rd.data.z source · line 843 · raw
@zz:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
one stored byte, newest-first
def rd.data source · line 877 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
consume one stored byte
def rd.hlit source · line 906 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
HLIT, then HDIST
def rd.hdist source · line 932 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
HDIST, then HCLEN
def rd.hclen source · line 958 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
HCLEN, then that many 3-bit code lengths
def rd.clen.z source · line 983 · raw
@zz:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @+lens:List<&2, U32> -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
code lengths are in. Build the code-length table and read the rest.
def rd.clen source · line 1017 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @lens:List<&2, U32> -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
one 3-bit code length
def rd.back source · line 1044 · raw
@_wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
literal/length symbols again, after a distance
def rd.copied source · line 1067 · raw
@mm:Maybe<&2, List<&2, U32>> -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
install the copied bytes, or fail
def rd.docopy source · line 1097 · raw
@wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @+out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
copy left bytes from dist back
def rd.xdist source · line 1123 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
extra distance bits are in dist as the base
def rd.xdist0 source · line 1150 · raw
@zz:Bool -> @+extra:U32 -> @+base:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
no extra distance bits: the base is the distance
def rd.distsym source · line 1185 · raw
@+sy:U32 -> @zz:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
a distance symbol
def rd.xlen source · line 1216 · raw
@+val:U32 -> @_wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
extra length bits added to the base kept in left
def rd.xlen0 source · line 1243 · raw
@zz:Bool -> @+extra:U32 -> @+base:U32 -> @wh:Wh -> @final:Bool -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
no extra length bits
def rd.lit.n source · line 1278 · raw
@zz:Bool -> @+sy:U32 -> @wh:Wh -> @final:Bool -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
a length symbol, or the end of the block
def rd.lit.e source · line 1310 · raw
@zend:Bool -> @zlen:Bool -> @+sy:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
end of block, or a length code
def rd.lit source · line 1345 · raw
@zlit:Bool -> @zend:Bool -> @zlen:Bool -> @+sy:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
a literal byte
def rd.finish.at source · line 1382 · raw
@mm:Maybe<&2, lens.Split> -> @_wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @clen:List<&2, U32> -> @+_nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
both Huffman tables are built
def rd.finish source · line 1410 · raw
@+lens:List<&2, U32> -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @clen:List<&2, U32> -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
split the length list into literal and distance tables
def rd.push source · line 1435 · raw
@zz:Bool -> @+prev:U32 -> @+nleft:U32 -> @lens:List<&2, U32> -> @wh:Wh -> @final:Bool -> @+left:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a code length was stored. dist is 1 once any length exists.
def rd.rep16 source · line 1468 · raw
@zz:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+_rep:U32 -> St
code 16 needs a previous length
def rd.clen.t source · line 1499 · raw
@z18:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> St
code 18, or an illegal code-length symbol
def rd.clen.s source · line 1528 · raw
@z17:Bool -> @z18:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+_prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> St
codes 17 and 18 repeat zero
def rd.clen.r source · line 1562 · raw
@z16:Bool -> @z17:Bool -> @z18:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> St
repeat codes 16, 17, and 18
def rd.clens source · line 1597 · raw
@+sy:U32 -> @z15:Bool -> @z16:Bool -> @z17:Bool -> @z18:Bool -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
one code-length symbol
def rd.mrep.d source · line 1635 · raw
@zz:Bool -> @+lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
the repeat is done, or it ran past the list
def rd.mrep.z source · line 1669 · raw
@zbad:Bool -> @+nn:U32 -> @+prev:U32 -> @+nleft:U32 -> @lens:List<&2, U32> -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
reject a repeat that does not fit
def rd.mrep source · line 1703 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
extra bits of a repeat code
def rd.adler.eq source · line 1731 · raw
@zz:Bool -> @+raw:List<&2, U32> -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
Adler matches the bytes
def rd.adler.z source · line 1762 · raw
@zz:Bool -> @+run:U32 -> @+left:U32 -> @+out:List<&2, U32> -> @wh:Wh -> @final:Bool -> @+dist:U32 -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+sym:U32 -> @+rep:U32 -> St
one more Adler byte, or the check
def rd.adler source · line 1797 · raw
@+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @+out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
one big-endian Adler byte
def rd.field source · line 1826 · raw
@md:Md -> @+val:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a finished integer field
def rd.raw.at source · line 1921 · raw
@zz:Bool -> @md:Md -> @wh:Wh -> @+acc:U32 -> @+got:U32 -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
keep a partial integer, or dispatch it
def rd.raw source · line 1959 · raw
@md:Md -> @wh:Wh -> @+acc:U32 -> @+got:U32 -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> @+bit:U32 -> St
fold one bit into the integer being read
def rd.miss source · line 1992 · raw
@zz:Bool -> @+code:U32 -> @+len:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
fifteen bits and no symbol is an error
def rd.symbol source · line 2025 · raw
@+sy:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+rep:U32 -> St
dispatch a decoded symbol
def rd.hbit.at source · line 2065 · raw
@found:Maybe<&2, U32> -> @+code:U32 -> @+len:U32 -> @wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> St
a symbol, or more bits
def rd.hbit source · line 2101 · raw
@+wh:Wh -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @+lit:List<&2, U32> -> @+dts:List<&2, U32> -> @+clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+hacc:U32 -> @+hlen:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> @+bit:U32 -> St
shift one Huffman bit in. The first bit is the high bit of the code.
def rd.on source · line 2133 · raw
@ph:Ph -> @md:Md -> @wh:Wh -> @+acc:U32 -> @+got:U32 -> @+need:U32 -> @final:Bool -> @+left:U32 -> @+dist:U32 -> @out:List<&2, U32> -> @lit:List<&2, U32> -> @dts:List<&2, U32> -> @clen:List<&2, U32> -> @lens:List<&2, U32> -> @+nleft:U32 -> @+prev:U32 -> @+cmf:U32 -> @+hacc:U32 -> @+hlen:U32 -> @+skew:U32 -> @+hlit:U32 -> @+hdist:U32 -> @+run:U32 -> @+sym:U32 -> @+rep:U32 -> @+bit:U32 -> St
one bit of the phase the reader is in
def rd.step source · line 2186 · raw
@st:St -> @+bit:U32 -> St
advance one bit. The bit count mod 8 tracks byte alignment.
def inflate.go source · line 2200 · raw
@bits:List<&2, U32> -> @st:St -> Maybe<&2, List<&2, U32>>
walk the bit list until the reader finishes or the bits run out
def inflate source · line 2218 · raw
@xs:List<&2, U32> -> Maybe<&2, List<&2, U32>>
inflate a zlib wrapper around DEFLATE, as PNG compression method 0