From a7897ddcde5c157117ea87a339e3768d457b156e Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 23 May 2025 00:21:00 +0300 Subject: [PATCH] get rid of NEEQUAL_NEGZERO as compatibility checking now relies on eequal, it can no longer do funky things --- src/README.md | 1 - src/builtins/compare.c | 18 ++++++------------ test/various.bqn | 5 +---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/README.md b/src/README.md index a1bcb863..51c488de 100644 --- a/src/README.md +++ b/src/README.md @@ -454,7 +454,6 @@ Most toggles require a value of `1` to be enabled. #define DEBUG_VM 0 // print evaluation of every bytecode #define USE_VALGRIND 0 // adjust memory manager & code for valgrind usage #define VERIFY_TAIL (u) // number of bytes after the end of an array to verify not being improperly modified; 64 in DEBUG -#define NEEQUAL_NEGZERO 0 // make negative zero not equal zero for •internal.EEqual #define RT_VERIFY_ARGS 1 // rtverify: preserve arguments for printing on failure #define GC_EVERY_NTH_ALLOC (u) // force a GC on every n'th allocation (<=1 to GC on every alloc) diff --git a/src/builtins/compare.c b/src/builtins/compare.c index afeae4a3..c757efee 100644 --- a/src/builtins/compare.c +++ b/src/builtins/compare.c @@ -75,9 +75,7 @@ NOINLINE bool atomEqualF(B w, B x) { } bool atomEEqual(B w, B x) { // doesn't consume - #if !NEEQUAL_NEGZERO - if (isF64(w) & isF64(x)) return w.f==x.f; - #endif + if (isF64(w) & isF64(x)) return w.f==x.f; if (!isVal(w) || !isVal(x)) return false; if (TI(w,byRef) || TY(w)!=TY(x)) return false; @@ -156,16 +154,12 @@ u8 const matchFnData[] = { // for the main diagonal, amount to shift length by; #undef DEF_EQ #endif static NOINLINE bool notEq(void* a, void* b, u64 l, u64 data) { assert(l>0); return false; } -static NOINLINE bool eequalFloat(void* wp0, void* xp0, u64 ia, u64 data) { - f64* wp = wp0; - f64* xp = xp0; - u64 r = 1; +static NOINLINE bool eequalFloat(void* wp, void* xp, u64 ia, u64 data) { + bool r = true; for (ux i = 0; i < (ux)ia; i++) { - #if NEEQUAL_NEGZERO - r&= ((u64*)wp)[i] == ((u64*)xp)[i]; - #else - r&= (wp[i]==xp[i]) | (wp[i]!=wp[i] & xp[i]!=xp[i]); - #endif + f64 w = ((f64*)wp)[i]; + f64 x = ((f64*)xp)[i]; + r&= (w==x) | (w!=w & x!=x); } return r; } diff --git a/test/various.bqn b/test/various.bqn index 376f565e..c7099ac4 100644 --- a/test/various.bqn +++ b/test/various.bqn @@ -85,7 +85,4 @@ Mod ← {𝕊: # •Show "heap corruption test of bit/i16" ⋄ "Ai16"‿1‿50 BitSlash 1000000 # •Show "heap corruption test of bit/i32" ⋄ "Ai32"‿1‿50 BitSlash 1000000 -{ - ¬0 EEQ -0? •Out "Skipping tests requiring !NEEQUAL_NEGZERO"; - •Show "⊔ consistency" ⋄ Group 10000 -} +•Show "⊔ consistency" ⋄ Group 10000