diff --git a/src/builtins/grade.h b/src/builtins/grade.h index 3ec9a8c9..cb83fe53 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -299,7 +299,7 @@ B GRADE_CAT(c2)(B t, B w, B x) { if (LIKELY(wef; 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) && xeflags) { + 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 && xeflags && elInt(xe)) { i32 wi = o2iu(w); u8 rtid = v(f)->flags-1; if (xe==el_bit) { diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 27053bcc..19429152 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -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 diff --git a/src/builtins/select.c b/src/builtins/select.c index a7fca7ef..e70f6de1 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -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 && wiare?xe:re; bool reuse = reusable(x); if (me==el_i32) { diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 529edefe..67fa629c 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -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); diff --git a/src/core/stuff.h b/src/core/stuff.h index e9b77deb..cd095f60 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -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