shithub: sl

Download patch

ref: 8a0e768ec1dcd20cc39774f21b612472dc21e53d
parent: 29f7fd737b0cbb12f15531f47e7c21430225afde
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Mar 14 12:50:27 EDT 2023

don't use labs on potentially 64 bit integers since on plan 9 long is 32 bits

--- a/flisp.c
+++ b/flisp.c
@@ -849,7 +849,8 @@
             lerrorf(ArgError, "keyword %s requires an argument",
                     symbol_name(v));
         value_t hv = fixnum(((symbol_t*)ptr(v))->hash);
-        uintptr_t x = 2*(labs(numval(hv)) % n);
+        lltint_t lx = numval(hv);
+        uintptr_t x = 2*((lx < 0 ? -lx : lx) % n);
         if (vector_elt(kwtable, x) == v) {
             uintptr_t idx = numval(vector_elt(kwtable, x+1));
             assert(idx < nkw);