From a8c5dd658120193c646f28a04044671e4eb1695c Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 25 Sep 2021 15:26:06 +0300 Subject: [PATCH] better squeezing --- src/builtins/fns.c | 2 +- src/core/stuff.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/builtins/fns.c b/src/builtins/fns.c index c51b16ac..6bb2283a 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -143,7 +143,7 @@ B indexOf_c1(B t, B x) { if (cmax) max = c; } - i64 dst = 1 + max-(i64)min; + i64 dst = 1 + (max-(i64)min); if ((dst>31); } goto r_or; } @@ -496,7 +496,7 @@ B num_squeeze(B x) { goto r_f64; } i32 c = o2iu(xp[i]); - or|= c<0?-c:c; + or|= ((u32)c) ^ (u32)(c>>31); } goto r_or; } @@ -509,12 +509,12 @@ B num_squeeze(B x) { goto r_f64; } i32 c = o2iu(cr); - or|= c<0?-c:c; + or|= ((u32)c) ^ (u32)(c>>31); } r_or: - if (or>=0 && or<=I8_MAX ) goto r_i8; - else if (or>=0 && or<=I16_MAX) goto r_i16; - else goto r_i32; + if (or<=(u32)I8_MAX ) goto r_i8; + else if (or<=(u32)I16_MAX) goto r_i16; + else goto r_i32; r_x : return FL_SET(x, fl_squoze); r_i8 : return FL_SET(toI8Any (x), fl_squoze);