code wiki / (root) / nx_set.nx

nx_set.nx

buildroot/runtime/nx_set.nx

3011 B95 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_set.nx -- unordered set of i64 elements. Thin wrapper over nx_hash that uses the value as both key and a sentinel "1" payload. Foundation for: * Visited-set in graph traversals (DFS/BFS) * Reachable-block analysis in opt * Used-symbol tracking in nxld * Dedup of result lists API: nx_set_new(cap_pow2) nx_set_add(s, x) -- 1 if newly added, 0 if already present nx_set_has(s, x) -- 1 / 0 nx_set_count(s) Caller invariant (inherited from nx_hash): element 0 is reserved (collides with empty-slot sentinel). If you need to track 0, use nx_intern instead (which has its own remapping).

dependencies 2 imports · 0 importers

syscalls.nx nx_hash.nx nx_set.nx

imports: syscalls.nxnx_hash.nx

imported by: nobody (leaf or entry point)

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

main nx_set_new nx_hash_new nx_set_count nx_hash_count nx_set_add nx_hash_has nx_hash_probe nx_hash_fnv1a_i64 nx_hash_put nx_hash_probe ↻ nx_set_has nx_hash_has ↻

structs

30struct NxSet

consts

34const NX_SET_BYTES: i64 = 8

functions

36func nx_set_new(cap_pow2: i64) -> *NxSet
called by 1: main calls 1: nx_hash_new
44func nx_set_add(s: *NxSet, x: i64) -> i64
called by 1: main calls 2: nx_hash_hasnx_hash_put
52func nx_set_has(s: *NxSet, x: i64) -> i64
called by 1: main calls 1: nx_hash_has
57func nx_set_count(s: *NxSet) -> i64 { return nx_hash_count(s.h) }
called by 1: main calls 1: nx_hash_count
61func main() -> i64