code wiki / (root) / nx_sketch_bit_vector.nx

nx_sketch_bit_vector.nx

buildroot/runtime/nx_sketch_bit_vector.nx

6357 B249 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind sketch/demotopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_bit_vector.nx -- dense bit vector with popcount + bitwise ops. Foundational primitive for bitmap indices, finite-universe set ops, Bloom variants, sparse-index compression, etc. API: set(i) bit i := 1 clear(i) bit i := 0 toggle(i) bit i := ~bit i get(i) return bit i (0 or 1) popcount() count of set bits (cached on mutation) popcount_range(lo, hi) count over [lo, hi) ffs() find first set bit (-1 if none) ffc() find first clear bit bv_and / bv_or / bv_xor / bv_not in-place bitwise ops Production tier; exact semantics.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sketch_types.nx nx_sketch_bit_vector.nx

imports: nx_syscalls.nxnx_sketch_types.nx

imported by: nobody (leaf or entry point)

structs

31struct BitVector

consts

28const NX_BV_MIN_BITS: i64 = 8
29const NX_BV_MAX_BITS: i64 = 1073741824 // 1G bits = 128 MB

functions

41func nx_bv_alloc(n_bits: i64) -> *BitVector
calls 1: sys_mmap
62func nx_bv_set(v: *BitVector, i: i64) -> i64
76func nx_bv_clear(v: *BitVector, i: i64) -> i64
90func nx_bv_toggle(v: *BitVector, i: i64) -> i64
108func nx_bv_get(v: *BitVector, i: i64) -> i64
118func nx_bv_popcount_byte(b: i64) -> i64
128func nx_bv_recompute_popcount(v: *BitVector) -> i64
called by 1: nx_bv_popcount calls 1: nx_bv_popcount_byte
140func nx_bv_popcount(v: *BitVector) -> i64
147func nx_bv_popcount_range(v: *BitVector, lo: i64, hi: i64) -> i64
calls 1: nx_bv_get
162func nx_bv_ffs(v: *BitVector) -> i64
calls 1: nx_bv_get
171func nx_bv_ffc(v: *BitVector) -> i64
calls 1: nx_bv_get
184func nx_bv_and(dst: *BitVector, src: *BitVector) -> i64
195func nx_bv_or(dst: *BitVector, src: *BitVector) -> i64
206func nx_bv_xor(dst: *BitVector, src: *BitVector) -> i64
217func nx_bv_not(v: *BitVector) -> i64
229func nx_bv_query_popcount(v: *BitVector) -> *ApproxI64
236func nx_bv_memory_bytes(v: *BitVector) -> i64
240func nx_bv_clear_all(v: *BitVector) -> i64