nx_mathcore.nx
buildroot/runtime/nx_mathcore.nx
about
nx_mathcore.nx -- emit an EXACT multi-precision product so an OUTSIDE arithmetic can adjudicate it.
The gate beside this organ (nx_mathcore_gate) proves our exact arithmetic by algebraic identity, which is
OUR instrument judging OUR artifact. That is one method class. The second class needs a witness we did not
write and cannot influence, which is why this organ exists: it prints a real product of real operands in a
form any arbitrary-precision arithmetic on earth can check, so a third party can CONFIRM it -- and, handed a
perturbed digit, must REFUSE it. A witness that cannot disagree proves nothing.
nx_mathcore mul <decimal_a> <decimal_b>
-> MATHCORE-MUL a=<dec> b=<dec> product=<32 hex digits, big-endian, 128 bits>
Operands are parsed as unsigned decimal into two 32-bit limbs each; the product is four limbs, serialised
big-endian by the same bi_to_bytes_be the crypto lane uses. No floats anywhere, by construction.
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_bigint_lib.nxnx_itoa_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 18 | const MC_SLOTS: i64 = 8 |
| 19 | const MC_SLOT_BYTES: i64 = 64 |
| 20 | const MC_PROD_BYTES: i64 = 16 // 4 limbs x 32 bits = 128 bits |
| 21 | const MC_FULL_LIMB: i64 = 0xFFFFFFFF |
| 22 | const MC_N2: i64 = 2 |
| 23 | const MC_N4: i64 = 4 |
| 24 | const MC_ASCII_0: i64 = 48 |
| 25 | const MC_ASCII_9: i64 = 57 |
| 26 | const MC_ASCII_a: i64 = 97 |
| 27 | const MC_HEX_A_OFF: i64 = 10 |
| 28 | const MC_USAGE: i64 = 2 |
functions
| 30 | func mc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: mc_puts |
| 31 | func mc_puts(s: *u8) -> i64 { sys_write(1, s, mc_slen(s)); return 0 } |
| 32 | func mc_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 39 | func mc_atou(s: *u8) -> i64 called by 1: main |
| 52 | func mc_put64(x: *i64, v: i64) -> i64 |
| 58 | func mc_hexdigit(v: i64) -> i64 called by 1: main |
| 63 | func main(argc: i64, argv: *i64) -> i64 |