merge_fill_result changes
incl. fixing when rr==k
This commit is contained in:
parent
78764ec47c
commit
edf1f2df7e
@ -232,24 +232,19 @@ static NOINLINE B to_fill_cell(B x, ur k, u32 chr) { // consumes x
|
|||||||
return taga(ca);
|
return taga(ca);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NOINLINE B merge_fill_result_impl(B rc, ur k, usz* sh, u32 chr) {
|
static NOINLINE B merge_fill_result(B rc, ur k, usz* sh, u32 chr) {
|
||||||
u64 rr = k; if (isArr(rc)) rr += RNK(rc);
|
u64 rr = k; if (isArr(rc)) rr+= RNK(rc);
|
||||||
if (rr>UR_MAX) thrF("%c: Result rank too large", chr);
|
if (rr>UR_MAX) thrF("%c: Result rank too large", chr);
|
||||||
Arr* r = m_fillarrpEmpty(getFillQ(rc));
|
Arr* r = m_fillarrpEmpty(getFillQ(rc));
|
||||||
usz* rsh = arr_shAlloc(r, rr);
|
usz* rsh = arr_shAlloc(r, rr);
|
||||||
if (rr>1) {
|
if (rr>1) {
|
||||||
shcpy(rsh, sh, k);
|
shcpy(rsh, sh, k);
|
||||||
shcpy(rsh+k, SH(rc), rr-k);
|
usz cr = rr-k;
|
||||||
|
if (cr) shcpy(rsh+k, SH(rc), cr);
|
||||||
}
|
}
|
||||||
dec(rc);
|
dec(rc);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
static B merge_fill_result_k(B rc, ur k, usz* sh) {
|
|
||||||
return merge_fill_result_impl(rc, k, sh, U'⎉');
|
|
||||||
}
|
|
||||||
static B merge_fill_result_1(B rc) {
|
|
||||||
return merge_fill_result_impl(rc, 1, (usz[]){0}, U'˘');
|
|
||||||
}
|
|
||||||
static NOINLINE B cell2_empty(B f, B w, B x, ur wr, ur xr) {
|
static NOINLINE B cell2_empty(B f, B w, B x, ur wr, ur xr) {
|
||||||
if (!isPureFn(f) || !CATCH_ERRORS) { dec(w); dec(x); return emptyHVec(); }
|
if (!isPureFn(f) || !CATCH_ERRORS) { dec(w); dec(x); return emptyHVec(); }
|
||||||
if (wr) w = to_fill_cell(w, 1, U'˘');
|
if (wr) w = to_fill_cell(w, 1, U'˘');
|
||||||
@ -257,7 +252,7 @@ static NOINLINE B cell2_empty(B f, B w, B x, ur wr, ur xr) {
|
|||||||
if (CATCH) { freeThrown(); return emptyHVec(); }
|
if (CATCH) { freeThrown(); return emptyHVec(); }
|
||||||
B rc = c2(f, w, x);
|
B rc = c2(f, w, x);
|
||||||
popCatch();
|
popCatch();
|
||||||
return merge_fill_result_1(rc);
|
return merge_fill_result(rc, 1, (usz[]){0}, U'˘');
|
||||||
}
|
}
|
||||||
static f64 req_whole(f64 f) {
|
static f64 req_whole(f64 f) {
|
||||||
if (floor(f)!=f) thrM("⎉: 𝕘 was a fractional number");
|
if (floor(f)!=f) thrM("⎉: 𝕘 was a fractional number");
|
||||||
@ -374,7 +369,7 @@ B for_cells_c1(B f, u32 xr, u32 cr, u32 k, B x, u32 chr) { // F⎉cr x, with 0
|
|||||||
} else {
|
} else {
|
||||||
B rc = c1(f, cf);
|
B rc = c1(f, cf);
|
||||||
popCatch();
|
popCatch();
|
||||||
r = merge_fill_result_k(rc, k, xsh);
|
r = merge_fill_result(rc, k, xsh, chr);
|
||||||
}
|
}
|
||||||
if (xr>1) ptr_dec(s);
|
if (xr>1) ptr_dec(s);
|
||||||
return r;
|
return r;
|
||||||
@ -494,7 +489,7 @@ static NOINLINE B rank2_empty(B f, B w, ur wk, B x, ur xk) {
|
|||||||
} else {
|
} else {
|
||||||
B rc = c2(f, w, x);
|
B rc = c2(f, w, x);
|
||||||
popCatch();
|
popCatch();
|
||||||
r = merge_fill_result_k(rc, k, sh);
|
r = merge_fill_result(rc, k, sh, U'⎉');
|
||||||
}
|
}
|
||||||
if (sho) ptr_dec(s);
|
if (sho) ptr_dec(s);
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user