code wiki / (root) / nx_headmark_lib.nx

nx_headmark_lib.nx source

↩ module page · 19 lines · 630 B

1// AUTO-EXTRACTED shared base (nx_oo_extract). license_tier: ORIGINAL No hw writes (Rule 26). 2// functions: uw_headmark,uw_generated 3import "nx_syscalls.nx" 4func uw_headmark(buf: *u8, n: i64, pat: *u8, plen: i64) -> i64 { 5 var lim: i64 = 400 6 if n < lim { lim = n } 7 var i: i64 = 0 8 while i + plen <= lim { 9 var ok: i64 = 1 10 var j: i64 = 0 11 while j < plen { if buf[i + j] != pat[j] { ok = 0; j = plen } else { j = j + 1 } } 12 if ok == 1 { return 1 } 13 i = i + 1 14 } 15 return 0 16} 17func uw_generated(buf: *u8, n: i64) -> i64 { 18 return uw_headmark(buf, n, "GENERATED" as *u8, 9) 19}