code wiki / _hdl_build / nx_breakmin.nx

nx_breakmin.nx source

↩ module page · 19 lines · 553 B

1// nx_breakmin.nx -- bisect variant H: minimal hang candidate. 2// outer while / inner scan loop with else-break / if{assign} after it. 3func bp_is_name(c: i64) -> i64 { 4 if c >= 97 { if c <= 122 { return 1 } } 5 return 0 6} 7 8func main() -> i64 { 9 let s: *u8 = "ab cd=e\x00" as *u8 10 let end: i64 = 7 11 var i4: i64 = 0 12 var rounds: i64 = 0 13 while i4 < end { 14 while i4 < end { if bp_is_name(s[i4] & 0xff) == 1 { i4 = i4 + 1 } else { break } } 15 if i4 < 99 { i4 = i4 + 1 } 16 rounds = rounds + 1 17 } 18 return rounds 19}