code wiki / (root) / nx_strconv.nx

nx_strconv.nx

buildroot/runtime/nx_strconv.nx

7993 B253 linesdepth 4pulls 4 transitivereach 102 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_strconv.nx -- string <-> integer conversion utilities. Foundational for every CLI tool: parsing argv ints, formatting counts in log lines, decoding hex addresses for the debugger. Today the inline patterns scattered across runtime/ duplicate this work in 14 places (nx_objdump, nx_readelf, nx_dbg, nx_addr2line, nx_diff, nx_argv, nxc_native_wrap, ...). Centralise here so they all agree on edge cases (negative MIN_I64, leading "+", overflow detection, hex prefix tolerance).

dependencies 2 imports · 60 importers

syscalls.nx nx_ascii.nx nx_strconv.nx nx_bigread_test.nx nx_checkpoint.nx nx_crosshw_census.nx nx_dequant_bench.nx nx_dequant_bench_test.nx nx_dequant_iter_bench_test.nx nx_emit_journal.nx nx_f32_linear_simd.nx nx_f32_llm_bench_test.nx nx_f32_llm_diag_test.nx

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

imports: syscalls.nxnx_ascii.nx

imported by: nx_bigread_test.nxnx_checkpoint.nxnx_crosshw_census.nxnx_dequant_bench.nxnx_dequant_bench_test.nxnx_dequant_iter_bench_test.nxnx_emit_journal.nxnx_f32_linear_simd.nxnx_f32_llm_bench_test.nxnx_f32_llm_diag_test.nxnx_f32_llm_dim_dump_test.nxnx_f32x8_dot_bench.nxnx_flashattn_scale.nxnx_gguf_load_block.nxnx_ingest_runner_test.nxnx_linear_attn_bench.nxnx_live_fire_gguf_test.nxnx_mizar_stream_ingest.nxnx_q4k_dot_simd.nxnx_q4k_gemm_mt.nxnx_q4k_linear.nxnx_q4k_linear_hp.nxnx_q4k_matmul_bench_test.nxnx_q4k_real_gemm.nxnx_q4k_speed_bench.nxnx_q5k_dot_row_col.nxnx_q5k_dot_simd.nxnx_q8_0_dot.nxnx_q8_0_linear_verify.nxnx_qwen_blk0_types.nxnx_qwen_hybrid_attn.nxnx_qwen_hybrid_ffn.nxnx_qwen_hybrid_qkv.nxnx_real_gguf_test.nxnx_shard_writer.nxnx_simd_dot_bench.nxnx_strconv_gate.nxnx_tok_probe.nxnx_vram_estimate.nxnx_workflow_ingest.nxnx_workflow_knobs.nxnx_zimage_adaln_verify.nxnx_zimage_attn_verify.nxnx_zimage_dequant_block.nxnx_zimage_ffn_down_verify.nxnx_zimage_ffn_norm_verify.nxnx_zimage_ffn_swiglu_verify.nxnx_zimage_flashattn_verify.nxnx_zimage_gguf_arch.nxnx_zimage_gguf_probe.nxnx_zimage_layout.nxnx_zimage_outproj_verify.nxnx_zimage_qknorm_verify.nxnx_zimage_qkv_verify.nxnx_zimage_real_op.nxnx_zimage_real_proj.nxnx_zimage_real_qkv.nxnx_zimage_sdpa_verify.nxnx_zimage_sdpaonly_verify.nxnx_zimage_weights.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_strconv_parse_i64 nx_ascii_is_digit nx_strconv_parse_hex nx_strconv_is_hex_digit nx_ascii_is_digit ↻ nx_strconv_hex_digit_val nx_strconv_format_i64 nx_strconv_format_hex

structs

none

consts

20const NX_MAGIC_12345: i64 = 12345
23const NX_STRCONV_ERR_EMPTY: i64 = -1
24const NX_STRCONV_ERR_BAD_CHAR: i64 = -2
25const NX_STRCONV_ERR_OVERFLOW: i64 = -3

functions

30func nx_strconv_is_hex_digit(c: i64) -> i64
37func nx_strconv_hex_digit_val(c: i64) -> i64
48func nx_strconv_parse_i64(s: *u8, out_err: *i64) -> i64
called by 2: mainmain calls 1: nx_ascii_is_digit
85func nx_strconv_parse_hex(s: *u8, out_err: *i64) -> i64
115func nx_strconv_format_i64(v: i64, buf: *u8) -> i64
152func nx_strconv_format_hex(v: i64, buf: *u8, prefix: i64, min_width: i64) -> i64
called by 1: main
192func main() -> i64