From 62d73b6acfaa6f7055d630a9f4394c0ca7b139d9 Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 4 Jun 2021 03:15:01 +0300 Subject: [PATCH] faster asFill --- src/core/fillarr.c | 15 ++++++++++++++- src/core/stuff.c | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/fillarr.c b/src/core/fillarr.c index 6e213cfa..97f8e616 100644 --- a/src/core/fillarr.c +++ b/src/core/fillarr.c @@ -2,8 +2,21 @@ B asFill(B x) { // consumes if (isArr(x)) { + u8 xe = TI(x).elType; + usz ia = a(x)->ia; + if (xe<=el_f64) { + i32* rp; B r = m_i32arrc(&rp, x); + for (usz i = 0; i < ia; i++) rp[i] = 0; + dec(x); + return r; + } + if (xe==el_c32) { + u32* rp; B r = m_c32arrc(&rp, x); + for (usz i = 0; i < ia; i++) rp[i] = 0; + dec(x); + return r; + } HArr_p r = m_harrUc(x); - usz ia = r.c->ia; BS2B xget = TI(x).get; bool noFill = false; for (usz i = 0; i < ia; i++) if ((r.a[i]=asFill(xget(x,i))).u == bi_noFill.u) noFill = true; diff --git a/src/core/stuff.c b/src/core/stuff.c index 11fd1ab2..b1c2b08d 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -248,7 +248,7 @@ NOINLINE bool equal(B w, B x) { // doesn't consume usz ia = a(x)->ia; u8 we = TI(w).elType; u8 xe = TI(x).elType; - if (we<=el_f64 && xe<=el_f64) { + if (we<=el_f64 && xe<=el_f64) { assert(we==el_i32|we==el_f64); assert(xe==el_i32|xe==el_f64); if (we==el_i32) { i32* wp = i32any_ptr(w); if(xe==el_i32) { i32* xp = i32any_ptr(x); for (usz i = 0; i < ia; i++) if(wp[i]!=xp[i]) return false; } else { f64* xp = f64any_ptr(x); for (usz i = 0; i < ia; i++) if(wp[i]!=xp[i]) return false; }