split fillEqual into rare and non-rare versions

This commit is contained in:
dzaima 2021-05-27 19:44:15 +03:00
parent d9110e8b5a
commit 3ad82faadd
3 changed files with 10 additions and 8 deletions

View File

@ -64,12 +64,7 @@ void validateFill(B x) {
}
}
bool fillEqual(B w, B x) { // doesn't consume
if (w.u==x.u) return true;
bool wa = isAtm(w);
bool xa = isAtm(x);
if (wa!=xa) return false;
if (wa) return false;
NOINLINE bool fillEqualR(B w, B x) { // doesn't consume; both args must be arrays
if (!eqShape(w, x)) return false;
usz ia = a(w)->ia;
if (ia==0) return true;

View File

@ -10,7 +10,7 @@ typedef struct FillSlice {
B asFill(B x); // consumes
void validateFill(B x);
bool fillEqual(B w, B x);
B withFill(B x, B fill); // consumes both
static B qWithFill(B x, B fill) { // consumes both
assert(isArr(x));
@ -18,6 +18,13 @@ static B qWithFill(B x, B fill) { // consumes both
return withFill(x, fill);
}
NOINLINE bool fillEqualR(B w, B x);
static bool fillEqual(B w, B x) {
if (w.u==x.u) return true;
if (isAtm(w)|isAtm(x)) return false;
return fillEqualR(w, x);
}
static B getFillR(B x) { // doesn't consume; can return bi_noFill
if (isArr(x)) {

View File

@ -104,7 +104,7 @@ CTR_FOR(F)
static const u16 C32_TAG = 0b0111111111110001; // 0111111111110001................00000000000ccccccccccccccccccccc char
static const u16 TAG_TAG = 0b0111111111110010; // 0111111111110010................nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn special value (0=nothing, 1=undefined var, 2=bad header; 3=optimized out; 4=error?; 5=no fill)
static const u16 VAR_TAG = 0b0111111111110011; // 0111111111110011ddddddddddddddddnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn variable reference
static const u16 EXT_TAG = 0b0111111111110100; // 0111111111110011ddddddddddddddddnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn extended variable reference
static const u16 EXT_TAG = 0b0111111111110100; // 0111111111110100ddddddddddddddddnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn extended variable reference
static const u16 I32_TAG = 0b0111111111110111; // 0111111111110111................nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn 32-bit int; unused
static const u16 MD1_TAG = 0b1111111111110010; // 1111111111110010ppppppppppppppppppppppppppppppppppppppppppppp000 1-modifier
static const u16 MD2_TAG = 0b1111111111110011; // 1111111111110011ppppppppppppppppppppppppppppppppppppppppppppp000 2-modifier