remove barely-useful elType==el_i32 path of reshape

perhaps could be replaced with an <=el_i32 path that still uses GetU but just skips numberness/integerness checks and ∘/⌊/⌽/↑ logic
This commit is contained in:
dzaima 2024-02-13 22:30:11 +02:00
parent 26a4bc9ac3
commit 5abb09ca74

View File

@ -160,22 +160,11 @@ B shape_c2(B t, B w, B x) {
nr = 1;
sh = NULL;
} else {
if (isAtm(w)) w = m_unit(w);
if (RARE(isAtm(w))) w = m_unit(w);
if (RNK(w)>1) thrM("⥊: 𝕨 must have rank at most 1");
if (IA(w)>UR_MAX) thrM("⥊: Result rank too large");
nr = IA(w);
sh = nr<=1? NULL : m_shArr(nr);
if (TI(w,elType)==el_i32) {
i32* wi = i32any_ptr(w);
if (nr>1) for (i32 i = 0; i < nr; i++) sh->a[i] = wi[i];
bool bad=false, good=false;
for (i32 i = 0; i < nr; i++) {
if (wi[i]<0) thrF("⥊: 𝕨 contained %i", wi[i]);
bad|= mulOn(nia, wi[i]);
good|= wi[i]==0;
}
if (bad && !good) thrM("⥊: 𝕨 too large");
} else {
SGetU(w)
i32 unkPos = -1;
i32 unkInd ONLY_GCC(=0);
@ -223,7 +212,6 @@ B shape_c2(B t, B w, B x) {
xia = nia;
}
}
}
decG(w);
}