code wiki / (root) / nx_zip_deflate_selected_candidate_t144.nx

nx_zip_deflate_selected_candidate_t144.nx

buildroot/runtime/nx_zip_deflate_selected_candidate_t144.nx

4616 B82 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind librarytopic zip
docsdependenciesstructsconstsfunctions

about

nx_zip_deflate_lib.nx -- ZIP method-8 (DEFLATE) ENTRY WRITER, composing the two incumbents the estate already proves: nx_zip.nx (the STORED writer + reader, its reflected CRC-32 and its central-directory shape) and nx_deflate_enc.nx (the sovereign RFC 1951 compressor). nx_zip.nx names this exact rung in its own header ("wiring nx_deflate_enc.nx in as method 8 is a compression improvement"); it lands as a SIBLING lib rather than an edit of nx_zip.nx so the writer's many importers do not grow the compressor into their closures. Same state vector (st[NX_ZIP_ST_*]), same finalize (nxzip_finalize): a caller mixes nxzip_add_stored and nxzip_add_deflated entries freely. WHY (2026-09-06, /compare/modding MD1): a bundle walker that reads only STORED entries is the DanceXR-class reader the rung exists to exceed; its gate needs a REAL method-8 fixture to prove the DEFLATE path and to make a STORED-only reader fail. A compressed member that would GROW is stored instead (csize would exceed usize): every real archiver does the same, and a caller can read the method back from the central directory to see which it got. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_zip_selected_candidate_t144.nx nx_deflate_enc.nx nx_zip_deflate_selected_candid nx_bundle_ingest_selected_gate_t14

imports: nx_syscalls.nxnx_zip_selected_candidate_t144.nxnx_deflate_enc.nx

imported by: nx_bundle_ingest_selected_gate_t144.nx

structs

none

consts

16const NX_ZIP_METHOD_DEFLATE: i64 = 8
17const NXZD_FLAG_NONE: i64 = 0
18const NXZD_ENC_HEADROOM: i64 = 64 // fixed-Huffman framing above the input for an incompressible member before the STORED fallback wins

functions

22func nxzd_scratch_bytes(len: i64) -> i64 { return len + len / 4 + NXZD_ENC_HEADROOM }
26func nxzip_add_deflated(out: *u8, cap: i64, cd: *u8, cdcap: i64, st: *i64,