elInt
This commit is contained in:
parent
203916b44f
commit
7d716d5ce0
@ -299,7 +299,7 @@ B GRADE_CAT(c2)(B t, B w, B x) {
|
||||
if (LIKELY(we<el_B & xe<el_B)) {
|
||||
if (elNum(we)) { // number
|
||||
if (elNum(xe)) {
|
||||
if (we==el_f64 | xe==el_f64) goto gen;
|
||||
if (!elInt(we) | !elInt(xe)) goto gen;
|
||||
w=toI32Any(w); x=toI32Any(x);
|
||||
} else {
|
||||
for (u64 i=0; i<xia; i++) rp[i]=wia; goto done;
|
||||
|
||||
@ -234,7 +234,7 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
ur xr = RNK(x); usz* xsh = SH(x); usz ia = IA(x);
|
||||
B wf = getFillQ(w);
|
||||
u8 xe = TI(x,elType);
|
||||
if (xr==1 && q_i32(w) && xe<el_f64 && isFun(f) && v(f)->flags) {
|
||||
if (xr==1 && q_i32(w) && elInt(xe) && isFun(f) && v(f)->flags) {
|
||||
u8 rtid = v(f)->flags-1;
|
||||
i32 wv = o2iu(w);
|
||||
if (xe==el_bit) {
|
||||
@ -365,7 +365,7 @@ B fold_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
if (isAtm(x) || RNK(x)!=1) thrF("´: 𝕩 must be a list (%H ≡ ≢𝕩)", x);
|
||||
usz ia = IA(x);
|
||||
u8 xe = TI(x,elType);
|
||||
if (q_i32(w) && isFun(f) && v(f)->flags && xe<el_f64) {
|
||||
if (q_i32(w) && isFun(f) && v(f)->flags && elInt(xe)) {
|
||||
i32 wi = o2iu(w);
|
||||
u8 rtid = v(f)->flags-1;
|
||||
if (xe==el_bit) {
|
||||
|
||||
@ -210,7 +210,7 @@ static usz check_rank_vec(B g) {
|
||||
usz gia = IA(g);
|
||||
if (!(gia>=1 && gia<=3)) thrM("⎉: 𝔾 result must have 1 to 3 elements");
|
||||
SGetU(g)
|
||||
if (TI(g,elType)>=el_f64) for (i32 i = 0; i < gia; i++) req_whole(o2f(GetU(g,i)));
|
||||
if (!elInt(TI(g,elType))) for (i32 i = 0; i < gia; i++) req_whole(o2f(GetU(g,i)));
|
||||
return gia;
|
||||
}
|
||||
static ur cell_rank(f64 r, f64 k) { // ⎉k over arg rank r
|
||||
|
||||
@ -186,10 +186,10 @@ B select_ucw(B t, B o, B w, B x) {
|
||||
u8 xe = TI(x,elType);
|
||||
u8 re = TI(rep,elType);
|
||||
SLOWIF(!reusable(x) && xia>100 && wia<xia/50) SLOW2("⌾(𝕨⊸⊏)𝕩 because not reusable", w, x);
|
||||
if (we<=el_i32) {
|
||||
if (elInt(we)) {
|
||||
w = toI32Any(w);
|
||||
i32* wp = i32any_ptr(w);
|
||||
if (re<=el_f64 && xe<=el_f64) {
|
||||
if (elNum(re) && elNum(xe)) {
|
||||
u8 me = xe>re?xe:re;
|
||||
bool reuse = reusable(x);
|
||||
if (me==el_i32) {
|
||||
|
||||
@ -1287,7 +1287,7 @@ B group_c2(B t, B w, B x) {
|
||||
usz xia = IA(x);
|
||||
if (wia-xia > 1) thrF("⊔: ≠𝕨 must be either ≠𝕩 or one bigger (%s≡≠𝕨, %s≡≠𝕩)", wia, xia);
|
||||
u8 we = TI(w,elType);
|
||||
if (we<=el_i32) {
|
||||
if (elInt(we)) {
|
||||
if (we!=el_i32) w = taga(cpyI32Arr(w));
|
||||
i32* wp = i32any_ptr(w);
|
||||
i64 ria = wia==xia? 0 : wp[xia];
|
||||
@ -1561,7 +1561,7 @@ B slash_ucw(B t, B o, B w, B x) {
|
||||
if (isAtm(w) || isAtm(x) || RNK(w)!=1 || RNK(x)!=1 || IA(w)!=IA(x)) return def_fn_ucw(t, o, w, x);
|
||||
usz ia = IA(x);
|
||||
SGetU(w)
|
||||
if (TI(w,elType)>el_i32) for (usz i = 0; i < ia; i++) if (!q_i32(GetU(w,i))) return def_fn_ucw(t, o, w, x);
|
||||
if (!elInt(TI(w,elType))) for (usz i = 0; i < ia; i++) if (!q_i32(GetU(w,i))) return def_fn_ucw(t, o, w, x);
|
||||
B arg = slash_c2(t, inc(w), inc(x));
|
||||
usz argIA = IA(arg);
|
||||
B rep = c1(o, arg);
|
||||
@ -1572,7 +1572,7 @@ B slash_ucw(B t, B o, B w, B x) {
|
||||
usz repI = 0;
|
||||
if (TY(w) == t_bitarr) {
|
||||
u64* d = bitarr_ptr(w);
|
||||
if (TI(x,elType)<=el_i32 && TI(rep,elType)<=el_i32) {
|
||||
if (elInt(TI(x,elType)) && elInt(TI(rep,elType))) {
|
||||
if (r->fns->elType!=el_i32) mut_to(r, el_i32);
|
||||
i32* rp = r->ai32;
|
||||
x = toI32Any(x); i32* xp = i32any_ptr(x);
|
||||
|
||||
@ -145,6 +145,9 @@ static bool elChr(u8 x) {
|
||||
static bool elNum(u8 x) {
|
||||
return x<=el_f64;
|
||||
}
|
||||
static bool elInt(u8 x) {
|
||||
return x<=el_i32;
|
||||
}
|
||||
|
||||
// string stuff
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user