From fb5ee179cbb334ab192200ffad45c33c3a95f2ac Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 16 Nov 2024 08:27:36 -0500 Subject: [PATCH] Squeeze for slash_im generic case instead of converting individual elements to numbers --- src/builtins/slash.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/builtins/slash.c b/src/builtins/slash.c index 302320c9..a80703cc 100644 --- a/src/builtins/slash.c +++ b/src/builtins/slash.c @@ -842,6 +842,7 @@ B slash_im(B t, B x) { usz xia = IA(x); if (xia==0) { decG(x); return emptyIVec(); } B r; + retry: switch(xe) { default: UD; case el_bit: { usz sum = bit_sum(bitany_ptr(x), xia); @@ -957,21 +958,12 @@ B slash_im(B t, B x) { break; } case el_c8: case el_c16: case el_c32: case el_B: { - SLOW1("/⁼", x); + x = num_squeezeChk(x); + xe = TI(x,elType); + if (elNum(xe)) goto retry; B* xp = TO_BPTR(x); - usz i,j; i64 max=-1; - for (i = 0; i < xia; i++) { i64 c=o2i64(xp[i]); if (c<=max) break; max=c; } - for (j = i; j < xia; j++) { i64 c=o2i64(xp[j]); max=c>max?c:max; if (c<0) thrM("/⁼: Argument cannot contain negative numbers"); } - if (max > USZ_MAX-1) thrOOM(); - usz ria = max+1; - if (i==xia) { - u64* rp; r = m_bitarrv(&rp, ria); for (usz i=0; i