conflates C size_t and Singeli u64 → uint64_t, and Singeli can't emit size_t
This commit is contained in:
dzaima 2025-07-01 02:14:26 +03:00
parent ddb8d7c111
commit b13e4101fa
3 changed files with 17 additions and 8 deletions

View File

@ -126,7 +126,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by;
#include "../utils/includeSingeli.h" #include "../utils/includeSingeli.h"
#else #else
#define F(X) equal_##X #define F(X) equal_##X
bool F(1_1)(void* w, void* x, ux l, u64 d) { bool F(1_1)(void* w, void* x, u64 l, u64 d) {
assert(l>0); assert(l>0);
u64* wp = w; u64* xp = x; u64* wp = w; u64* xp = x;
usz q = l/64; usz q = l/64;
@ -134,7 +134,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by;
usz r = (-l)%64; return r==0 || (wp[q]^xp[q])<<r == 0; usz r = (-l)%64; return r==0 || (wp[q]^xp[q])<<r == 0;
} }
#define DEF_EQ_U1(N, T) \ #define DEF_EQ_U1(N, T) \
bool F(1_##N)(void* w, void* x, ux l, u64 d) { assert(l>0); \ bool F(1_##N)(void* w, void* x, u64 l, u64 d) { assert(l>0); \
if (d!=0) { void* t=w; w=x; x=t; } \ if (d!=0) { void* t=w; w=x; x=t; } \
u64* wp = w; T* xp = x; \ u64* wp = w; T* xp = x; \
for (usz i=0; i<l; i++) if (bitp_get(wp,i)!=xp[i]) return false; \ for (usz i=0; i<l; i++) if (bitp_get(wp,i)!=xp[i]) return false; \
@ -144,7 +144,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by;
DEF_EQ_U1(16, i16) DEF_EQ_U1(16, i16)
DEF_EQ_U1(32, i32) DEF_EQ_U1(32, i32)
DEF_EQ_U1(f64, f64) DEF_EQ_U1(f64, f64)
bool equal_f64_f64_reflexive(void* wp, void* xp, ux l, u64 data) { bool equal_f64_f64_reflexive(void* wp, void* xp, u64 l, u64 data) {
bool r = true; bool r = true;
for (ux i = 0; i < l; i++) { for (ux i = 0; i < l; i++) {
f64 w = ((f64*)wp)[i]; f64 w = ((f64*)wp)[i];
@ -156,7 +156,7 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by;
#undef DEF_EQ_U1 #undef DEF_EQ_U1
#define DEF_EQ_I(NAME, S, T, INIT) \ #define DEF_EQ_I(NAME, S, T, INIT) \
bool F(NAME)(void* w, void* x, ux l, u64 d) { \ bool F(NAME)(void* w, void* x, u64 l, u64 d) { \
assert(l>0); INIT \ assert(l>0); INIT \
S* wp = w; T* xp = x; \ S* wp = w; T* xp = x; \
for (ux i=0; i<l; i++) if (wp[i]!=xp[i]) return false; \ for (ux i=0; i<l; i++) if (wp[i]!=xp[i]) return false; \
@ -173,7 +173,16 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by;
#undef DEF_EQ_I #undef DEF_EQ_I
#undef DEF_EQ #undef DEF_EQ
#endif #endif
static NOINLINE bool notEq(void* a, void* b, ux l, u64 data) { assert(l>0); return false; } static NOINLINE bool notEq(void* a, void* b, u64 l, u64 data) { assert(l>0); return false; }
static NOINLINE bool eequalFloat(void* wp, void* xp, u64 l, u64 data) {
bool r = true;
for (ux i = 0; i < l; i++) {
f64 w = ((f64*)wp)[i];
f64 x = ((f64*)xp)[i];
r&= (w==x) | (w!=w & x!=x);
}
return r;
}
#define MAKE_TABLE(NAME, F64_F64) \ #define MAKE_TABLE(NAME, F64_F64) \
INIT_GLOBAL MatchFn NAME[] = { \ INIT_GLOBAL MatchFn NAME[] = { \

View File

@ -11,7 +11,7 @@ def swap{w,x} = {
} }
# width{W} ≤ width{X} # width{W} ≤ width{X}
fn equal{W, X}(w:*void, x:*void, l:ux, d:u64) : u1 = { fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = {
def vw = arch_defvw{} def vw = arch_defvw{}
def bulk = vw / width{X} def bulk = vw / width{X}
if (W!=X) if (d!=0) swap{w,x} if (W!=X) if (d!=0) swap{w,x}
@ -80,7 +80,7 @@ def any_ne_reflexive_qnan{M, a:V=[k](f64), b:V} = { # (a==b) | (isQNaN{a} & isQN
~andn_bit_none{M, t2, t1} ~andn_bit_none{M, t2, t1}
} }
fn equal_reflexive{}(w:*void, x:*void, l:ux, d:u64) : u1 = { fn equal_reflexive{}(w:*void, x:*void, l:u64, d:u64) : u1 = {
def w = *f64~~w def w = *f64~~w
def x = *f64~~x def x = *f64~~x
def bulk = arch_defvw{} / width{f64} def bulk = arch_defvw{} / width{f64}

View File

@ -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_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) #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, ux l, u64 data); typedef bool (*MatchFn)(void* a, void* b, u64 l, u64 data);
extern INIT_GLOBAL MatchFn matchFns[]; extern INIT_GLOBAL MatchFn matchFns[];
extern INIT_GLOBAL MatchFn matchFnsR[]; extern INIT_GLOBAL MatchFn matchFnsR[];
extern u8 const matchFnData[]; extern u8 const matchFnData[];