w6a: replace private streq with strings.compare (Wave-2 hand-rolled->lib)

This commit is contained in:
2026-06-03 03:33:09 +09:00
parent af87ff4f31
commit 05609dcc34
3 changed files with 8 additions and 30 deletions

View File

@@ -15,6 +15,7 @@ import os;
import rt;
import mem;
import opcodes;
import strings;
// ---- text buffer growth ------------------------------------------------
@@ -212,20 +213,10 @@ fn sserrw(a: *asm_, prefix: u8, op2: u8, regop: i32, rmop: i32) void = {
// ---- label resolution / fixups ----------------------------------------
fn streq(a: str, b: str) bool = {
if (a.len != b.len) { return false; };
let i: i32 = 0;
for (i < a.len) {
if (a[i] != b[i]) { return false; };
i += 1;
};
return true;
};
fn resolvelabel(a: *asm_, name: str) u64 = {
let s: *asym = a.syms;
for (s != nil) {
if (s.defined != 0) { if (streq(s.name, name)) { return s.addr; }; };
if (s.defined != 0) { if (strings.compare(s.name, name) == 0) { return s.addr; }; };
s = s.snext;
};
return 0u64;
@@ -234,7 +225,7 @@ fn resolvelabel(a: *asm_, name: str) u64 = {
fn labeldefined(a: *asm_, name: str) bool = {
let s: *asym = a.syms;
for (s != nil) {
if (s.defined != 0) { if (streq(s.name, name)) { return true; }; };
if (s.defined != 0) { if (strings.compare(s.name, name) == 0) { return true; }; };
s = s.snext;
};
return false;