Commit: ba63744242e8ca671c4a91c5bc9b9c21f24b6931
Parent: ab1aa357b4c0427d168d75d1a05592de7e6e8f6f
Author: Randy Palamar
Date: Thu, 12 Mar 2026 06:31:51 -0600
util: move s8_equal from build into util
This is needed by the test programs in additional to build.c
Diffstat:
3 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/build.c b/build.c
@@ -196,15 +196,6 @@ read_entire_file(const char *file, Arena *arena)
}
function b32
-s8_equal(s8 a, s8 b)
-{
- b32 result = a.len == b.len;
- for (iz i = 0; result && i < a.len; i++)
- result = a.data[i] == b.data[i];
- return result;
-}
-
-function b32
s8_contains(s8 s, u8 byte)
{
b32 result = 0;
diff --git a/tests/throughput.c b/tests/throughput.c
@@ -202,15 +202,6 @@ usage(char *argv0)
argv0);
}
-function b32
-s8_equal(s8 a, s8 b)
-{
- b32 result = a.len == b.len;
- for (iz i = 0; result && i < a.len; i++)
- result &= a.data[i] == b.data[i];
- return result;
-}
-
function Options
parse_argv(i32 argc, char *argv[])
{
diff --git a/util.c b/util.c
@@ -588,6 +588,15 @@ c_str_to_s8(char *cstr)
return result;
}
+function b32
+s8_equal(s8 a, s8 b)
+{
+ b32 result = a.len == b.len;
+ for (iz i = 0; result && i < a.len; i++)
+ result = a.data[i] == b.data[i];
+ return result;
+}
+
/* NOTE(rnp): returns < 0 if byte is not found */
function iz
s8_scan_backwards(s8 s, u8 byte)