nx_zip_read.nx
buildroot/runtime/nx_zip_read.nx
about
nx_zip_read.nx -- SOVEREIGN ZIP reader (the first half of the PyTorch .bin loader). A PyTorch .bin is a ZIP
archive of STORED (uncompressed) members: archive/data.pkl (the pickle describing the state_dict) + archive/
data/0, data/1, ... (raw tensor blobs) + archive/version. This finds the End-Of-Central-Directory record,
walks the central directory, and lists every member (name / method / size / local-header offset), plus locates
a member's raw data (STORED = data begins right after the local header). Tested on the REAL 50.7MB HiFi-GAN
pytorch_model.bin just downloaded. Next: a minimal pickle-VM over data.pkl. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 8 | const K_MAGIC_67108864: i64 = 67108864 |
functions
| 10 | func p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 11 | func pn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let d: *u8=sys_mmap(24); var k: i64=0; while m>0 {d[k]=(48+(m%10)) as u8; m=m/10; k=k+1} var i: i64=k-1; while i>=0 {let o: *u8=sys_mmap(1); o[0]=d[i]; sys_write(1,o,1); i=i-1} return 0 } |
| 12 | func pc(c: i64) -> i64 { let o: *u8=sys_mmap(1); o[0]=c as u8; sys_write(1,o,1); return 0 } |
| 14 | func u16le(b: *u8, o: i64) -> i64 { return (b[o]&0xff) | ((b[o+1]&0xff)<<8) } |
| 15 | func u32le(b: *u8, o: i64) -> i64 { return (b[o]&0xff) | ((b[o+1]&0xff)<<8) | ((b[o+2]&0xff)<<16) | ((b[o+3]&0xff)<<24) } called by 1: main |
| 18 | func find_eocd(b: *u8, n: i64) -> i64 called by 1: main |
| 27 | func member_data_off(b: *u8, lho: i64) -> i64 |
| 33 | func main() -> i64 |