From 1e5307832421486cad57bc9c6d017f5e1b1ef367 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 23 May 2025 00:47:04 +0300 Subject: [PATCH] make match functions take ux instead of u64 for length --- src/builtins/compare.c | 12 ++++++------ src/singeli/src/equal.singeli | 2 +- src/utils/calls.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/builtins/compare.c b/src/builtins/compare.c index 03f88702..d7aadbdc 100644 --- a/src/builtins/compare.c +++ b/src/builtins/compare.c @@ -115,7 +115,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by; #include "../utils/includeSingeli.h" #else #define F(X) equal_##X - bool F(1_1)(void* w, void* x, u64 l, u64 d) { + bool F(1_1)(void* w, void* x, ux l, u64 d) { assert(l>0); u64* wp = w; u64* xp = x; usz q = l/64; @@ -123,7 +123,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by; usz r = (-l)%64; return r==0 || (wp[q]^xp[q])<0); \ + bool F(1_##N)(void* w, void* x, ux l, u64 d) { assert(l>0); \ if (d!=0) { void* t=w; w=x; x=t; } \ u64* wp = w; T* xp = x; \ for (usz i=0; i0); INIT \ S* wp = w; T* xp = x; \ for (usz i=0; i0); return false; } -static NOINLINE bool eequalFloat(void* wp, void* xp, u64 ia, u64 data) { +static NOINLINE bool notEq(void* a, void* b, ux l, u64 data) { assert(l>0); return false; } +static NOINLINE bool eequalFloat(void* wp, void* xp, ux l, u64 data) { bool r = true; - for (ux i = 0; i < (ux)ia; i++) { + for (ux i = 0; i < l; i++) { f64 w = ((f64*)wp)[i]; f64 x = ((f64*)xp)[i]; r&= (w==x) | (w!=w & x!=x); diff --git a/src/singeli/src/equal.singeli b/src/singeli/src/equal.singeli index 96c195bf..1ce0adb6 100644 --- a/src/singeli/src/equal.singeli +++ b/src/singeli/src/equal.singeli @@ -11,7 +11,7 @@ def swap{w,x} = { } # width{W} ≤ width{X} -fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = { +fn equal{W, X}(w:*void, x:*void, l:ux, d:u64) : u1 = { def vw = arch_defvw def bulk = vw / width{X} if (W!=X) if (d!=0) swap{w,x} diff --git a/src/utils/calls.h b/src/utils/calls.h index b605d3cd..a92c5f5f 100644 --- a/src/utils/calls.h +++ b/src/utils/calls.h @@ -26,7 +26,7 @@ CMP_DEF(le, AS); #define CMP_AA_IMM(FN, ELT, WHERE, WP, XP, LEN) CMP_AA_CALL(CMP_AA_FN(FN, ELT), WHERE, WP, XP, LEN) #define CMP_AS_IMM(FN, ELT, WHERE, WP, X, LEN) CMP_AS_CALL(CMP_AS_FN(FN, ELT), WHERE, WP, X, LEN) -typedef bool (*MatchFn)(void* a, void* b, u64 l, u64 data); +typedef bool (*MatchFn)(void* a, void* b, ux l, u64 data); extern INIT_GLOBAL MatchFn matchFns[]; extern INIT_GLOBAL MatchFn matchFnsR[]; extern u8 const matchFnData[];