Skip to content
ZLIB × LEAN / ALGORITHM DETAIL & VERIFICATION

Blocks and compression output

Write selected symbols into compressed blocks and safely deliver their bytes.

THE JOB OF THIS COMPONENT

Codes have different lengths, while applications receive whole bytes. This component chooses a block representation, packs codes into bytes, and holds undelivered bytes until the caller supplies space.

Locate this topic on the global map ↗

The first 3 chapters explain algorithms, data layouts, and optimizations. The final chapter connects the proof argument. Read in order or enter from a familiar stage.

  1. 01
    IMPLEMENTATION DETAIL

    Block selection and symbol costs

    Compare three block representations and see when sending new codes is worth its cost.

    ↗
  2. 02
    IMPLEMENTATION DETAIL

    Bit output and byte buffering

    Pack variable-length codes into bytes and deliver them to the caller.

    ↗
  3. 03
    IMPLEMENTATION DETAIL

    Shared storage and output prefixes

    Understand how shared memory can preserve symbols that have not yet been read.

    ↗
  4. 04
    PROOF ARGUMENT

    The output proof argument

    Explain how each write preserves meaning from symbols to delivered output.

    ↗
ZLIB × LEAN

Global contents

READING NOWBlocks and compression output