code wiki / (root) / nx_itoa_lib.nx

nx_itoa_lib.nx

buildroot/runtime/nx_itoa_lib.nx

4104 B77 linesdepth 2pulls 2 transitivereach 1773 importersview sourcekind librarytopic itoa
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 · 597 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_ag_lib.nx nx_ale_gap_filer.nx nx_ale_grade.nx

diagram shows first 10 each side; +0 more imports, +587 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_ag_lib.nxnx_ale_gap_filer.nxnx_ale_grade.nxnx_ale_plan.nxnx_ale_verify.nxnx_alloc.nxnx_andelin_v2.nxnx_apex_gcc_bench.nxnx_apistack_idempotency_epoch_candidate_t293.nxnx_arena_probe.nxnx_asset_page.nxnx_assign_gen.nxnx_audio_book.nxnx_audio_bowl.nxnx_audio_render.nxnx_avatar_splat.nxnx_axis_discover.nxnx_behaveprobe.nxnx_behaveprobe_review_candidate_t371.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_body_gen_profile_qualified_t239.nxnx_body_gen_skin_candidate_t345.nxnx_body_gen_winding_candidate_t365.nxnx_body_matched_serving_probe_t345.nxnx_body_profile_winding_candidate_t366.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_charjudge_census.nxnx_chat_demo_api.nxnx_chat_demo_unicode_t59.nxnx_chat_store.nxnx_chat_unicode_store_t60.nxnx_civicmap_lib.nxnx_cjc_panel_gate.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_lib.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_compare_ladder_capture.nxnx_compare_ladder_capture_test_20260907.nxnx_compare_preview_capture_t56.nxnx_compare_staged_capture.nxnx_compliance.nxnx_compose_builder.nxnx_comprehensiveness.nx +497 more (shown cap 100 declared)

structs

none

consts

27const CCZ_ASCII_0: i64 = 48
28const CCZ_MINUS: i64 = 45
29const CCZ_DEC: i64 = 10
37const NXI_BUF: i64 = 24
38const NXI_STDOUT: i64 = 1
39const NXI_STDERR: i64 = 2

functions

30func ccz_cat_num(buf:*u8,off:i64,v:i64)->i64
43func nxi_fd(fd: i64, v: i64) -> i64
51func nxi_out(v: i64) -> i64 { return nxi_fd(NXI_STDOUT, v) }
52func nxi_err(v: i64) -> i64 { return nxi_fd(NXI_STDERR, v) }
calls 1: nxi_fd
64func nxi_buf(dst: *u8, off: i64, v: i64) -> i64