faster asFill
This commit is contained in:
parent
ba28f7e892
commit
62d73b6acf
@ -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;
|
||||
|
||||
@ -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; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user