From 0164e4e0bc74d3e7e42650a511957122e7abcedd Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 1 May 2022 03:30:11 +0300 Subject: [PATCH] =?UTF-8?q?lazy=20i8/i16=20=E2=88=A7=F0=9D=95=A9=20&=20?= =?UTF-8?q?=E2=88=A8=F0=9D=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sort.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/builtins/sort.c b/src/builtins/sort.c index 7373cb70..e4a2d70d 100644 --- a/src/builtins/sort.c +++ b/src/builtins/sort.c @@ -31,7 +31,9 @@ B and_c1(B t, B x) { if (isAtm(x) || rnk(x)==0) thrM("∧: Argument cannot have rank 0"); if (rnk(x)!=1) return bqn_merge(and_c1(t, toCells(x))); usz xia = a(x)->ia; - if (TI(x,elType)==el_i32) { + u8 xe = TI(x,elType); + if (xe<=el_i32) { + if (xe!=el_i32) x = taga(cpyI32Arr(x)); i32* xp = i32any_ptr(x); i32* rp; B r = m_i32arrv(&rp, xia); memcpy(rp, xp, xia*4); @@ -63,7 +65,9 @@ B or_c1(B t, B x) { if (isAtm(x) || rnk(x)==0) thrM("∨: Argument cannot have rank 0"); if (rnk(x)!=1) return bqn_merge(or_c1(t, toCells(x))); usz xia = a(x)->ia; - if (TI(x,elType)==el_i32) { + u8 xe = TI(x,elType); + if (xe<=el_i32) { + if (xe!=el_i32) x = taga(cpyI32Arr(x)); i32* xp = i32any_ptr(x); i32* rp; B r = m_i32arrv(&rp, xia); memcpy(rp, xp, xia*4);