nx_zip_deflate_lib.nx
buildroot/runtime/nx_zip_deflate_lib.nx
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
imports: nx_syscalls.nxnx_zip.nxnx_deflate_enc.nx
imported by: nx_bundle_ingest_gate.nx
structs
| none |
consts
| 16 | const NX_ZIP_METHOD_DEFLATE: i64 = 8 |
| 17 | const NXZD_FLAG_NONE: i64 = 0 |
| 18 | const NXZD_ENC_HEADROOM: i64 = 64 // fixed-Huffman framing above the input for an incompressible member before the STORED fallback wins |
functions
| 22 | func nxzd_scratch_bytes(len: i64) -> i64 { return len + len / 4 + NXZD_ENC_HEADROOM } |
| 26 | func nxzip_add_deflated(out: *u8, cap: i64, cd: *u8, cdcap: i64, st: *i64, |