code wiki / _hdl_build / nx_adopt_lib.nx
nx_adopt_lib.nx
buildroot/runtime/_hdl_build/nx_adopt_lib.nx
about
nx_adopt_lib.nx -- PURE core of the ADOPTION CENSUS (operator priority, seq1410).
THE LAW THIS ENFORCES: **THIS ECOSYSTEM'S BOTTLENECK IS NOT BUILDING PRIMITIVES, IT IS ADOPTING THEM.**
Measured three times on 2026-07-30 alone: cpu-feature-detect existed with a KAT and was registered
nowhere (seq1359) · ss_close existed with 133 openers and 1 closer (seq1347) · nx_hw_cpu_count exists,
is CORRECT (sched_getaffinity, cgroup-safe), and has ZERO external callers in 19,823 files (seq1410)
while nx_torrent_get hardcodes MAXP=32. A build-only definition of done is why.
==> A ZERO-CALLER CAPABILITY PRIMITIVE IS A RED DEFECT, NOT A COMPLETED FEATURE.
★SCALE IS THE DESIGN PROBLEM, and the answer is the same one seq1318 taught: the naive census greps the
corpus ONCE PER PRIMITIVE = O(primitives x corpus) = ~50 GB of scanning for 500 primitives. Instead we
walk the corpus TWICE -- pass A collects definitions into a hash table, pass B counts every identifier
against it with O(1) lookups -- so the cost is O(corpus), independent of how many primitives exist.
LAW (third application today): ONE PASS OVER THE DATA, THEN ANSWER EVERY QUESTION FROM IT.
Rule 15: nx_funcmine already proved this shape (bucket-chained, O(files+funcs)). Its helpers live
inside an organ with a main(), so they cannot be imported -- THAT is why they are re-declared here, in
a LIB, so the next consumer imports instead of copying. nx_funcmine should migrate onto this lib.
license_tier: ORIGINAL Pure. No hw writes (Rule 26).
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_adopt.nx
structs
| none |
consts
| 22 | const AD_FNV_OFF: i64 = 1469598103934665603 |
| 23 | const AD_FNV_PRIME: i64 = 1099511628211 |
| 24 | const AD_EMPTY: i64 = 0 |
functions
| 27 | func ad_isid(c: i64) -> i64 |
| 36 | func ad_id_start(c: i64) -> i64 |
| 41 | func ad_ends_nx(nm: *u8) -> i64 called by 1: main |
| 51 | func ad_fnv(buf: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 60 | func ad_slot(h: i64, cap: i64) -> i64 called by 1: main |
| 67 | func ad_next(slot: i64, cap: i64) -> i64 { return (slot + 1) & (cap - 1) } called by 1: main |
| 70 | func ad_name_eq(arena: *u8, noff: i64, nlen: i64, buf: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 81 | func ad_is_adopted(external: i64) -> i64 |
| 107 | func ad_is_public(arena: *u8, noff: i64, nlen: i64) -> i64 called by 1: main |
| 117 | func ad_is_debt(external: i64, is_public: i64) -> i64 |