extract m_barrp_fill, make m_arrp_fill actually set fill

conditions were the wrong way around :|
This commit is contained in:
dzaima 2025-05-29 23:22:46 +03:00
parent 541e5a805e
commit 056cfd8367
3 changed files with 16 additions and 12 deletions

View File

@ -832,19 +832,21 @@ DirectArr toEltypeArr(B x, u8 re) { // consumes
UntaggedArr m_barrp_fill(B x, ux ia) { // doesn't consume
B fill = getFillR(x);
if (noFill(fill)) {
HArr_p r = m_harrUp(ia);
return (UntaggedArr) {(Arr*)r.c, r.a};
} else {
Arr* r = m_fillarrp(ia);
fillarr_setFill(r, fill);
return (UntaggedArr){r, fillarrv_ptr(r)};
}
}
UntaggedArr m_arrp_fill(B x, ux ia) { // doesn't consume
u8 xe = TI(x,elType);
if (xe==el_B) {
B fill = getFillR(x);
if (noFill(fill)) {
Arr* r = m_fillarrp(ia);
fillarr_setFill(r, fill);
return (UntaggedArr){r, fillarrv_ptr(r)};
} else {
HArr_p r = m_harrUp(ia);
return (UntaggedArr) {(Arr*)r.c, r.a};
}
}
if (xe==el_B) return m_barrp_fill(x, ia);
Arr* r;
void* rp = m_tyarrlbp(&r, elwBitLog(xe), ia, el2t(xe));
return (UntaggedArr) {r, rp};

View File

@ -298,7 +298,8 @@ DirectArr toEltypeArr(B x, u8 re); // consumes
DirectArr potentiallyReuse(B x); // doesn't consume
typedef struct { Arr* obj; void* data; } UntaggedArr;
UntaggedArr m_arrp_fill(B x, ux ia); // doesn't consume; create new array with the fill and eltype of x
UntaggedArr m_barrp_fill(B x, ux ia); // doesn't consume; create new fillarr or harr with the fill of x
UntaggedArr m_arrp_fill(B x, ux ia); // doesn't consume; create new array with the fill and eltype of x
typedef struct {
B res;

View File

@ -410,6 +410,7 @@ b←1↓1∾a←"hello" ⋄ b ⌽⎊'e' ⥊⟜1⍟2 5 ⋄ a ≡○•Hash b %% 1
%USE eqvarv 4 _eqvarv_"i" "abcde" %% ["abcd", "e "]
%USE eqvar 4 _eqvar "abcde" %% ["abcd", "eabc"]
%USE eqvar 4 _eqvar "abcde" %% ["abcd"]
%USE eqvar 22 _eqvar 1000 %% [01,23]
# 𝕨⍷𝕩
%USE eqvar "ab" _eqvar "" %%