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:
@@ -3625,15 +3625,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);
|
||||
@@ -22666,11 +22662,10 @@ fn cgdot(c: *cgen, n: *node) void = {
|
||||
croot = croot.lhs;
|
||||
};
|
||||
let it: *tinfo = nil;
|
||||
if (allptr) { if (croot != nil) { if (croot.kind == nkind.N_IDENT) {
|
||||
if (localfindnode(c, croot.str) != nil) {
|
||||
it = lhs.type_: *tinfo;
|
||||
};
|
||||
}; }; };
|
||||
if (allptr && croot != nil && croot.kind == nkind.N_IDENT &&
|
||||
localfindnode(c, croot.str) != nil) {
|
||||
it = lhs.type_: *tinfo;
|
||||
};
|
||||
for (it != nil && it.kind == tykind.TY_NAMED) { it = it.under; };
|
||||
if (it != nil) { if (it.kind == tykind.TY_PTR) {
|
||||
let st: *tinfo = it.sub;
|
||||
@@ -26442,11 +26437,10 @@ fn cgassign(c: *cgen, n: *node) void = {
|
||||
croot = croot.lhs;
|
||||
};
|
||||
let it: *tinfo = nil;
|
||||
if (allptr) { if (croot != nil) { if (croot.kind == nkind.N_IDENT) {
|
||||
if (localfindnode(c, croot.str) != nil) {
|
||||
it = base.type_: *tinfo;
|
||||
};
|
||||
}; }; };
|
||||
if (allptr && croot != nil && croot.kind == nkind.N_IDENT &&
|
||||
localfindnode(c, croot.str) != nil) {
|
||||
it = base.type_: *tinfo;
|
||||
};
|
||||
for (it != nil && it.kind == tykind.TY_NAMED) { it = it.under; };
|
||||
if (it != nil) { if (it.kind == tykind.TY_PTR) {
|
||||
let st: *tinfo = it.sub;
|
||||
|
||||
Reference in New Issue
Block a user