From 12c4fd0b078fda74afb14e448f1c0011731a9750 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 18 Sep 2022 16:15:20 -0400 Subject: [PATCH] Vectorizable usum code for i8, i16, i32 --- src/core/numarr.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/numarr.h b/src/core/numarr.h index 1a0f050b..b029ed7b 100644 --- a/src/core/numarr.h +++ b/src/core/numarr.h @@ -101,9 +101,9 @@ static u64 usum(B x) { // doesn't consume; may error usz xia = IA(x); u8 xe = TI(x,elType); if (xe==el_bit) return bit_sum(bitarr_ptr(x), xia); - else if (xe==el_i8 ) { i8* p = i8any_ptr (x); for (usz i = 0; i < xia; i++) { if (RARE(p[i]<0)) goto neg; r+= p[i]; } } - else if (xe==el_i16) { i16* p = i16any_ptr(x); for (usz i = 0; i < xia; i++) { if (RARE(p[i]<0)) goto neg; if (addOn(r,p[i])) goto overflow; } } - else if (xe==el_i32) { i32* p = i32any_ptr(x); for (usz i = 0; i < xia; i++) { if (RARE(p[i]<0)) goto neg; if (addOn(r,p[i])) goto overflow; } } + else if (xe==el_i8 ) { i8* p = i8any_ptr (x); i8 m=0; for (usz i = 0; i < xia; ) { usz b=1<< 8; i16 s=0; for (usz e = xia-i