nx_crc32.nx
buildroot/runtime/nx_crc32.nx
about
nx_crc32.nx -- CRC-32 (IEEE 802.3, gzip / zlib / png polynomial).
Used for: gzip integrity, png chunk checksums, ELF .gnu.hash
table consistency, network protocol framing checks.
We use the standard reflected polynomial (0xEDB88320), seed
0xFFFFFFFF, and final XOR 0xFFFFFFFF. Matches:
- zlib crc32()
- python binascii.crc32()
- tar/gzip/png/ethernet checksums
The 256-entry lookup table approach is the textbook method --
8 bits of input per iteration, ~1 GB/s on a modern CPU. We
build the table at runtime (no static initialisers in NishiLang
yet) and cache it in BSS so subsequent calls are O(n).
Slice-by-N (faster) is deferred until we benchmark a real bottleneck.
dependencies 1 imports · 16 importers
diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.
imports: syscalls.nx
imported by: nx_bgzf.nxnx_bgzf_test.nxnx_crc32_gate.nxnx_gzip_wrap.nxnx_image_e2e_gate.nxnx_image_index_gate.nxnx_img_decode_gate.nxnx_img_to_rgb_gate.nxnx_imgquery_e2e_gate.nxnx_opc.nxnx_png_adam7_gate.nxnx_png_decoder.nxnx_png_real_smoke.nxnx_revimg_crawl_gate.nxnx_roku_emit.nxnx_roku_grid_emit.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 34 | const NX_CRC32_POLY: i64 = 0xEDB88320 |
functions
| 38 | func nx_crc32_init() -> i64 |
| 66 | func nx_crc32_table_at(idx: i64) -> i64 |
| 82 | func nx_crc32_update(crc_in: i64, data: *u8, n: i64) -> i64 |
| 96 | func nx_crc32(data: *u8, n: i64) -> i64 |
| 102 | func main() -> i64 |