shithub: femtolisp

Download patch

ref: 49d1461e441aea2ebb5bd237bad1026723582b85
parent: 79a4a02a7dc88c3790f0a03f9ef8a4baae75b716
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Nov 19 04:39:35 EST 2024

mp: use 64-bit mpdigit on 64-bit platforms as it's slightly faster

--- a/3rd/mp/mptouv.c
+++ b/3rd/mp/mptouv.c
@@ -18,7 +18,9 @@
 	b->sign = 1;
 	for(s = 0; s < VLDIGITS; s++){
 		b->p[s] = v;
+#ifndef BITS64
 		v >>= Dbits;
+#endif
 	}
 	b->top = s;
 	return mpnorm(b);
--- a/3rd/mp/mptov.c
+++ b/3rd/mp/mptov.c
@@ -20,7 +20,9 @@
 	uv = v * b->sign;
 	for(s = 0; s < VLDIGITS; s++){
 		b->p[s] = uv;
+#ifndef BITS64
 		uv >>= Dbits;
+#endif
 	}
 	b->top = s;
 	return mpnorm(b);
--- a/posix/mp.h
+++ b/posix/mp.h
@@ -1,6 +1,10 @@
 #pragma once
 
+#ifdef BITS64
+typedef uint64_t mpdigit;
+#else
 typedef uint32_t mpdigit;
+#endif
 
 typedef union FPdbleword FPdbleword;
 union FPdbleword