shithub: femtolisp

Download patch

ref: b1573af3e04e04b2046eb0d2ef9dd92727b16ea6
parent: 477dc93db81feed168d2bcd42bc9a7fc3a88d4c0
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);