code wiki / (root) / nx_itoa_lib.nx

nx_itoa_lib.nx

buildroot/runtime/nx_itoa_lib.nx

4781 B95 linesdepth 2pulls 2 transitivereach 1138 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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 · 512 importers

nx_syscalls.nx nx_itoa_lib.nx dep_pipeline.nx nishi.nx nx_accesswall_research.nx nx_acl.nx nx_ad_core.nx nx_adversarial_ci.nx nx_aes_cbc.nx nx_ale_gap_filer.nx nx_ale_grade.nx nx_ale_plan.nx

diagram shows first 10 each side; +0 more imports, +502 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: dep_pipeline.nxnishi.nxnx_accesswall_research.nxnx_acl.nxnx_ad_core.nxnx_adversarial_ci.nxnx_aes_cbc.nxnx_ale_gap_filer.nxnx_ale_grade.nxnx_ale_plan.nxnx_ale_verify.nxnx_alloc.nxnx_andelin_v2.nxnx_apex_gcc_bench.nxnx_asset_page.nxnx_assign_gen.nxnx_audio_book.nxnx_audio_bowl.nxnx_audio_render.nxnx_axis_discover.nxnx_bench_census_lib.nxnx_bench_vs_c.nxnx_benchmark_ref.nxnx_bio_sequence.nxnx_bless_compiler.nxnx_blockfs.nxnx_blue_green.nxnx_body_gen.nxnx_bodybench.nxnx_book_search.nxnx_brand_book.nxnx_browser_arc_pipeline.nxnx_browser_exceed_census.nxnx_browser_os_census.nxnx_browser_user_sim.nxnx_browser_ux_census.nxnx_browser_xp.nxnx_bugforge.nxnx_build_bench.nxnx_build_run.nxnx_builder.nxnx_cand_build_run.nxnx_cap_census.nxnx_capreg_librarian.nxnx_cbx_pages.nxnx_cc_evidence.nxnx_ccdiag.nxnx_ch_census_oracle.nxnx_charjudge.nxnx_claim_verify.nxnx_classifier_sync.nxnx_clbg_fannkuch.nxnx_clobber_guard.nxnx_cmos.nxnx_cms_arc_pipeline.nxnx_cms_census.nxnx_cms_exceed_census.nxnx_cms_layered_spec.nxnx_cms_wp_scorecard.nxnx_coach_curriculum.nxnx_coach_exceed.nxnx_coach_gamify.nxnx_coach_rubric.nxnx_coco_eval.nxnx_code_review.nxnx_codec_real_rd.nxnx_codec_real_rd2.nxnx_codec_real_rd2f.nxnx_codec_real_rd2g.nxnx_codec_real_rd3.nxnx_codegrep.nxnx_codewiki.nxnx_coe_dsse.nxnx_coe_frame.nxnx_comp_engine.nxnx_compliance.nxnx_compose_builder.nxnx_comprehensiveness.nxnx_container_bench.nxnx_cp.nxnx_cr_exec_proof.nxnx_crashresume_census_core.nxnx_crew_live_verify.nxnx_crew_serve.nxnx_csv.nxnx_curvebench.nxnx_dc_core.nxnx_deploy_check.nxnx_deploy_guard.nxnx_deploy_lib.nxnx_deploy_secure.nxnx_derm.nxnx_diff_gen.nxnx_dns_a.nxnx_doc_member.nxnx_docpub_census.nxnx_docpub_publish.nxnx_docpub_pulse.nxnx_docpub_ship.nxnx_docx.nx +412 more (shown cap 100 declared)

structs

none

consts

27const CCZ_ASCII_0: i64 = 48
28const CCZ_MINUS: i64 = 45
29const CCZ_DEC: i64 = 10
49const NXI_BUF: i64 = 24
50const NXI_STDOUT: i64 = 1
51const NXI_STDERR: i64 = 2

functions

30func ccz_cat_num(buf: *u8, off: i64, v: i64) -> i64
55func nxi_fd(fd: i64, v: i64) -> i64
63func nxi_out(v: i64) -> i64 { return nxi_fd(NXI_STDOUT, v) }
64func nxi_err(v: i64) -> i64 { return nxi_fd(NXI_STDERR, v) }
calls 1: nxi_fd
76func nxi_buf(dst: *u8, off: i64, v: i64) -> i64
called by 3: mainof_catnd_putn