fix ⊢¨ {a←𝕩 ⋄ ⥊𝕩} 2‿3⥊<"a"

This commit is contained in:
dzaima 2023-04-23 22:16:58 +03:00
parent 2259e7b6a9
commit 927814d182
2 changed files with 5 additions and 4 deletions

View File

@ -147,13 +147,14 @@ static bool eqShPart(usz* w, usz* x, usz len) {
PLAINLOOP for (i32 i = 0; i < len; i++) if (w[i]!=x[i]) return false;
return true;
}
static bool eqShape(B w, B x) { assert(isArr(w)); assert(isArr(x));
ur wr = RNK(w); usz* wsh = SH(w);
ur xr = RNK(x); usz* xsh = SH(x);
static bool ptr_eqShape(Arr* w, Arr* x) {
ur wr = PRNK(w); usz* wsh = PSH(w);
ur xr = PRNK(x); usz* xsh = PSH(x);
if (wr!=xr) return false;
if (wsh==xsh) return true;
return eqShPart(wsh, xsh, wr);
}
static bool eqShape(B w, B x) { assert(isArr(w) && isArr(x)); return ptr_eqShape(a(w), a(x)); }
B bit_sel(B b, B e0, B e1); // consumes b; b must be bitarr; b⊏e0‿e1
Arr* allZeroes(usz ia);

View File

@ -77,7 +77,7 @@ B eachm_fn(B fo, B x, BB2B f) {
case t_fillslice: {
FillSlice* s = c(FillSlice,x);
Arr* p = s->p;
if (p->refc==1 && (p->type==t_fillarr || p->type==t_harr) && ((FillArr*)p)->a == s->a && p->ia==ia) {
if (p->refc==1 && (p->type==t_fillarr || p->type==t_harr) && ((FillArr*)p)->a == s->a && ptr_eqShape(p, a(x))) {
x = taga(ptr_inc(p));
value_free((Value*)s);
goto re_reuse;