Add the dependency
In your project’s ziran.toml; pin ref to a commit for reproducible builds.
[dependencies.compression]
git = "https://github.com/ziranlang/compression.git"
ref = "master"compression/src/inflate.zi
inflate
RFC 1951 DEFLATE and RFC 1952 gzip, implemented entirely in Ziran. Callers own a bounded output buffer. Malformed trees, distance overruns, truncated input, CRC mismatch and trailing streams are rejected.
Import with #import "compression/inflate".
Bits :: struct { input: []u8; at: s32; value: u32; count: s32; valid: bool; }Tree :: struct { counts: [16]s32; symbols: [288]s32; valid: bool; }Read :: (bits: *Bits, count: s32) -> u32Build :: (lengths: []s32) -> TreeSymbol :: (bits: *Bits, tree: *Tree) -> s32LengthBase: [29]s32LengthBits: [29]s32DistanceBase: [30]s32DistanceBits: [30]s32Order: [19]s32CodeOrder: [19]s32Deflate :: (input: []u8, output: []u8) -> s32Crc32 :: (bytes: []u8) -> u32Word :: (bytes: []u8, at: s32) -> u32Gzip :: (input: []u8, output: []u8) -> s32