pub struct lzw_decoder?( literal_width u32[2..8] = 8, stack[4096] u8, suffixes[4096] u8, prefixes[4096] u16, ) pub func lzw_decoder.decode?(dst ptr buf1, src ptr buf1, src_final bool)() { var bits u32 var n_bits u32 var clear_code u32 = (1 as u32) << this.literal_width // TODO: set end_code. var width u32[..12] = this.literal_width + 1 // TODO: implement. while true, pre n_bits < 8, { assert n_bits < (width + 8) via "a < (b + c): a < c; 0 <= b"() while n_bits < width, inv n_bits < (width + 8), post n_bits >= width, { assert n_bits < 12 via "a < b: a < c; c <= b"(c:width) bits |= (in.src.read_u8?() as u32) << n_bits // TODO: read_u8 should take src_final. n_bits += 8 } // TODO: var code u32[..4095] = bits.low_bits(width) bits >>= width n_bits -= width // TODO: s/bits/code/ if bits < clear_code { break } // TODO: implement. break } }