code wiki / (root) / nx_uleb.nx

nx_uleb.nx

buildroot/runtime/nx_uleb.nx

6570 B191 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_uleb.nx -- LEB128 (unsigned + signed) encoders + decoders. LEB128 (Little Endian Base 128) is a variable-length integer encoding used by DWARF, WebAssembly, Android dex, the MQTT protocol, and many others. Each byte carries 7 bits of payload plus a continuation bit (high bit) indicating "more bytes follow". Encoding rules: uleb128: - Take the low 7 bits, OR with 0x80 if more bits remain. - Shift right by 7, repeat until value is 0. sleb128: - Same, but stop when the remaining value is 0 AND the sign bit of the last 7-bit chunk is 0 (or value is -1 and the sign bit is 1). Today nx_dwarf_line.nx, nx_dwarf_loc.nx, and nx_dwarf_aranges.nx each have their own copies of these. This module is the single source of truth. As the off-C runtime grows new LEB128 consumers (WebAssembly support, dex parsing, BPF), they import here.

dependencies 2 imports · 0 importers

syscalls.nx nx_loop.nx nx_uleb.nx

imports: syscalls.nxnx_loop.nx

imported by: nobody (leaf or entry point)

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

main nx_uleb_enc_u nx_loop_begin sys_mmap nx_loop_step nx_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono nx_loop_break nx_uleb_dec_u nx_loop_begin ↻ nx_loop_step ↻ nx_loop_break ↻ nx_uleb_enc_s nx_loop_begin ↻ nx_loop_step ↻ nx_loop_break ↻ nx_uleb_dec_s nx_loop_begin ↻ nx_loop_step ↻ nx_loop_break ↻

structs

none

consts

none

functions

33func nx_uleb_enc_u(dst: *u8, off: i64, cap: i64, v: i64) -> i64
55func nx_uleb_enc_s(dst: *u8, off: i64, cap: i64, v: i64) -> i64
88func nx_uleb_dec_u(src: *u8, off: i64, cap: i64, out_val: *i64) -> i64
111func nx_uleb_dec_s(src: *u8, off: i64, cap: i64, out_val: *i64) -> i64
140func main() -> i64