lib/strings,wcc,w6l: collapse nested-if to &&/|| at named sites (Wave-2 structural)
strings.bytesub two endpoint guards, wcc cgdot/cgassign 4-deep allptr/N_IDENT/localfindnode pyramids, and w6l isarchive's 8 sequential magic-byte rejects. The isarchive len<8 read-guard stays a separate statement before the || chain so the byte reads remain bounded. Not byte-id-neutral (short-circuit emits tighter branches / renumbered labels) but functionally identical; cs==ww stage-parity holds. Regenerated all embedding combined.ww.
This commit is contained in:
@@ -2217,15 +2217,11 @@ export fn sub(s: str, start: i32, end: i32) str = {
|
||||
export fn bytesub(s: str, start: i32, end: i32) (str | utf8.invalid) = {
|
||||
os.assert(start <= end, "strings.bytesub: start is higher than end");
|
||||
os.assert(end <= s.len, "strings.bytesub: end exceeds string length");
|
||||
if (start < s.len) {
|
||||
if ((s[start] & 0xC0u8) == 0x80u8) {
|
||||
let e: utf8.invalid; return e;
|
||||
};
|
||||
if (start < s.len && (s[start] & 0xC0u8) == 0x80u8) {
|
||||
let e: utf8.invalid; return e;
|
||||
};
|
||||
if (end < s.len) {
|
||||
if ((s[end] & 0xC0u8) == 0x80u8) {
|
||||
let e: utf8.invalid; return e;
|
||||
};
|
||||
if (end < s.len && (s[end] & 0xC0u8) == 0x80u8) {
|
||||
let e: utf8.invalid; return e;
|
||||
};
|
||||
let r: str;
|
||||
r.ptr = s.ptr + (start: u64);
|
||||
@@ -3156,14 +3152,11 @@ type armember = struct {
|
||||
|
||||
fn isarchive(p: *u8, len: u64) bool = {
|
||||
if (len < 8u64) { return false; };
|
||||
if (p[0u64] != '!') { return false; };
|
||||
if (p[1u64] != '<') { return false; };
|
||||
if (p[2u64] != 'a') { return false; };
|
||||
if (p[3u64] != 'r') { return false; };
|
||||
if (p[4u64] != 'c') { return false; };
|
||||
if (p[5u64] != 'h') { return false; };
|
||||
if (p[6u64] != '>') { return false; };
|
||||
if (p[7u64] != '\n') { return false; };
|
||||
if (p[0u64] != '!' || p[1u64] != '<' || p[2u64] != 'a' || p[3u64] != 'r' ||
|
||||
p[4u64] != 'c' || p[5u64] != 'h' || p[6u64] != '>' ||
|
||||
p[7u64] != '\n') {
|
||||
return false;
|
||||
};
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user