nx_itoa_candidate_t228.nx
buildroot/runtime/nx_itoa_candidate_t228.nx
about
nx_itoa_lib.nx -- THE shared integer->decimal emitter. ONE copy, so the corpus stops retyping it.
LIFTED, NEVER COPIED (2026-07-31, debt 1785557603). ccz_cat_num was already correct, already
MSB-first, already zero-allocation, and already had 10+ callers -- it was simply IMPRISONED inside
nx_crashresume_census_core.nx, a crash-resume census organ. Seven files imported an entire census
just to print an integer. That import cost, NOT ignorance of the primitive, is why ~87 sites
hand-rolled their own. LAW: WHEN A CORRECT PRIMITIVE IS RETYPED, MEASURE ITS IMPORT COST BEFORE
BLAMING DISCOVERABILITY -- people do not retype what is CHEAP to reach.
THE LEAK WAS NEVER IN THE PRIMITIVE, IT WAS IN THE MISSING WRAPPER. ccz_cat_num allocates nothing.
What every clone hand-rolled was the fd shim around it, e.g. nx_lock_reap_gate.g_putn:
let b: *u8 = sys_mmap(32); let e: i64 = ccz_cat_num(b, 0, v); sys_write(1, b, e); return 0
-- one mmap per call, never freed. nxi_fd below is that shim, written ONCE and always freeing.
The census now imports THIS file; NishiLang import is transitive (verified: nx_lock_reap_gate
imports only nx_syscalls + nx_lock_reap_core, and resolves ccz_cat_num through the core), so all
existing callers keep resolving with no edit.
LAYERING: lives in runtime/ so BOTH runtime/ and _hdl_build/ can import it.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_itoa_gate_t228.nx
structs
| none |
consts
| 27 | const CCZ_ASCII_0: i64 = 48 |
| 28 | const CCZ_MINUS: i64 = 45 |
| 29 | const CCZ_DEC: i64 = 10 |
| 37 | const NXI_BUF: i64 = 24 |
| 38 | const NXI_STDOUT: i64 = 1 |
| 39 | const NXI_STDERR: i64 = 2 |
functions
| 30 | func ccz_cat_num(buf: *u8, off: i64, v: i64) -> i64 |
| 43 | func nxi_fd(fd: i64, v: i64) -> i64 |
| 51 | func nxi_out(v: i64) -> i64 { return nxi_fd(NXI_STDOUT, v) } calls 1: nxi_fd |
| 52 | func nxi_err(v: i64) -> i64 { return nxi_fd(NXI_STDERR, v) } calls 1: nxi_fd |
| 64 | func nxi_buf(dst: *u8, off: i64, v: i64) -> i64 |