shithub: femtolisp

Download patch

ref: 1b38f3de22cbaad22fbd3182cc65f22e7f4ba10f
parent: ed84debe7fb8a8932b4df46ded4ba0ac30bf2a6a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jul 10 07:22:28 EDT 2023

fix plan 9 arm build

--- a/3rd/mt19937-64.c
+++ b/3rd/mt19937-64.c
@@ -76,7 +76,7 @@
 void
 init_by_array64(mt19937_64 *context, unsigned long long init_key[], unsigned long long key_length)
 {
-    unsigned long long i, j, k;
+    unsigned long long i, j, k, m;
 
     init_genrand64(context, 19650218ULL);
     i = 1;
@@ -83,7 +83,9 @@
     j = 0;
     k = NN > key_length ? NN : key_length;
     for(; k; k--){
-        context->mt[i] = context->mt[i] ^ ((context->mt[i-1] ^ (context->mt[i-1] >> 62)) * 3935559000370003845ULL) + init_key[j] + j; /* non linear */
+		m = context->mt[i-1];
+		m = (m ^ (m >> 62)) * 3935559000370003845ULL;
+        context->mt[i] = context->mt[i] ^ m + init_key[j] + j; /* non linear */
         i++;
         j++;
         if(i >= NN){
@@ -94,7 +96,9 @@
         	j = 0;
     }
     for(k = NN-1; k; k--){
-        context->mt[i] = context->mt[i] ^ ((context->mt[i-1] ^ (context->mt[i-1] >> 62)) * 2862933555777941757ULL) - i; /* non linear */
+		m = context->mt[i-1];
+		m = (m ^ (m >> 62)) * 2862933555777941757ULL;
+        context->mt[i] = context->mt[i] ^ m - i; /* non linear */
         i++;
         if(i >= NN){
         	context->mt[0] = context->mt[NN-1];
--- a/flisp.h
+++ b/flisp.h
@@ -76,7 +76,7 @@
 #else
 #define T_FIXNUM T_INT32
 #define fits_fixnum(x) (((x)>>29) == 0 || (~((x)>>29)) == 0)
-#define mk_xlong mk_long
+#define mk_xlong mk_int32
 #endif
 
 #define ANYARGS -10000