reorder indexOf_c2

This commit is contained in:
dzaima 2022-12-24 17:04:57 +02:00
parent e3b5af8a44
commit 3f40955d83

View File

@ -43,7 +43,8 @@ static u64 elRange(u8 eltype) { return 1ull<<(1<<elWidthLogBits(eltype)); }
extern B rt_indexOf; extern B rt_indexOf;
B indexOf_c2(B t, B w, B x) { B indexOf_c2(B t, B w, B x) {
if (!isArr(w) || RNK(w)==0) thrM("⊐: 𝕨 must have rank at least 1"); if (!isArr(w) || RNK(w)==0) thrM("⊐: 𝕨 must have rank at least 1");
if (RNK(w)==1) { if (RNK(w)!=1) return c2(rt_indexOf, w, x);
if (!isArr(x) || RNK(x)==0) { if (!isArr(x) || RNK(x)==0) {
usz wia = IA(w); usz wia = IA(w);
B el = isArr(x)? IGetU(x,0) : x; B el = isArr(x)? IGetU(x,0) : x;
@ -117,8 +118,6 @@ B indexOf_c2(B t, B w, B x) {
return wia<=I8_MAX? taga(cpyI8Arr(r)) : wia<=I16_MAX? taga(cpyI16Arr(r)) : r; return wia<=I8_MAX? taga(cpyI8Arr(r)) : wia<=I16_MAX? taga(cpyI16Arr(r)) : r;
} }
} }
return c2(rt_indexOf, w, x);
}
B enclosed_0; B enclosed_0;
B enclosed_1; B enclosed_1;