code wiki / _hdl_build / _pe_pngtext.nx
_pe_pngtext.nx source
↩ module page · 19 lines · 515 B
1// AUTHORED BY THE NISHI BUILDER (pattern: STRUCT_WALK v2 magic/tailrest) -- field-table walk, no Claude logic
2import "nx_syscalls.nx"
3func _pe_pngtext_locate(b: *u8, n: i64, out: *i64) -> i64 {
4 var off: i64 = 0
5 if off >= n { return 0 - 1 }
6 var ks: i64 = off
7 while b[off] != (0 as u8) {
8 off = off + 1
9 if off >= n { return 0 - 1 }
10 }
11 out[2] = ks
12 out[3] = off - ks
13 out[4] = off + 1
14 off = off + 1
15 out[0] = off
16 out[1] = n - off
17 return 0
18 return 0 - 1
19}