From b2e65cc9b7e24abe4a56f19bb5928039bc171ff7 Mon Sep 17 00:00:00 2001 From: dzaima Date: Mon, 24 May 2021 18:05:35 +0300 Subject: [PATCH] separate out simple comparison --- src/core/stuff.c | 4 +--- src/core/stuff.h | 8 ++++++++ src/h.h | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/stuff.c b/src/core/stuff.c index bcdf3d1f..b51687b6 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -196,9 +196,7 @@ NOINLINE B append_fmt(B s, char* p, ...) { } #define CMP(W,X) ({ AUTO wt = (W); AUTO xt = (X); (wt>xt?1:0)-(wtxt?1:0)-(wtx, 0 if w≡x; 0==compare(NaN,NaN) + if (isNum(w) & isNum(x)) return CMP(o2fu(w), o2fu(x)); + if (isC32(w) & isC32(x)) return CMP(o2cu(w), o2cu(x)); + return compareR(w, x); +} +#undef CMP diff --git a/src/h.h b/src/h.h index 73fec9de..ddf3dbac 100644 --- a/src/h.h +++ b/src/h.h @@ -265,7 +265,6 @@ void print(B x); // doesn't consume void arr_print(B x); // doesn't consume bool equal(B w, B x); // doesn't consume bool eequal(B w, B x); // doesn't consume -i32 compare(B w, B x); // doesn't consume; -1 if wx, 0 if w≡x; 0==compare(NaN,NaN) bool atomEqual(B w, B x); // doesn't consume u64 depth(B x); // doesn't consume B toCells(B x); // consumes