nx_img_dims_gate.nx
buildroot/runtime/nx_img_dims_gate.nx
about
nx_img_dims_gate.nx -- KAT for the header dimension reader against hand-built PNG/GIF/JPEG headers with KNOWN
sizes + the KEEP-on-unknown invariant. Proves the importer's junk filter measures REAL pixels. GREEN iff 7/7.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_img_dims.nxnx_gate_verdict.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
| none |
functions
| 7 | func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 8 | func gn(v: i64) -> i64 { let b: *u8=sys_mmap(24); var m: i64=v; if m<0{gw("-" as *u8);m=0-m} let t: *u8=sys_mmap(24); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 9 | func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("\n" as *u8); return ok } |
| 10 | func hxn(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-87 } } if c>=65 { if c<=70 { return c-55 } } return 0 } called by 1: h2b |
| 11 | func h2b(s: *u8, out: *u8) -> i64 { var i: i64=0; var o: i64=0; while s[i]!=(0 as u8){ if s[i+1]==(0 as u8){i=i+1} else { out[o]=((hxn(s[i] as i64)<<4)|hxn(s[i+1] as i64)) as u8; o=o+1; i=i+2 } } return o } |
| 13 | func main() -> i64 |