Files
wuffs/std/gif/decode_lzw.puffs
T
Nigel Tao 4c0a659a18 Generate C function arguments.
Also rename "io.buf1" to just "buf1".
2017-06-02 16:14:59 +10:00

38 lines
742 B
Plaintext

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
// TODO: set clear_code, end_code, etc.
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 |= 0 // TODO.
n_bits += 8
}
// TODO: var code u32[..4095] = bits.low_bits(width)
bits >>= width
n_bits -= width
// TODO: implement.
break
}
}