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) -> u32
Build :: (lengths: []s32) -> Tree
Symbol :: (bits: *Bits, tree: *Tree) -> s32
LengthBase: [29]s32
LengthBits: [29]s32
DistanceBase: [30]s32
DistanceBits: [30]s32
Order: [19]s32
CodeOrder: [19]s32
Deflate :: (input: []u8, output: []u8) -> s32
Crc32 :: (bytes: []u8) -> u32
Word :: (bytes: []u8, at: s32) -> u32
Gzip :: (input: []u8, output: []u8) -> s32

Source ↗