shithub: femtolisp

Download patch

ref: 7c5abbdf89e73bbdb60218da480bd3d2830cf7cb
parent: 039aab41cdc6b13cdc012b893ff5e663beb894bc
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jan 12 17:39:41 EST 2025

mptod: fix the confusion with Dbits vs the actual type of v (uint64_t)

--- a/3rd/mp/mptod.c
+++ b/3rd/mp/mptod.c
@@ -31,12 +31,9 @@
 		else
 			w = a->p[i];
 		m = 54 - n;
-		if(m > Dbits){
+		if(m > Dbits)
 			m = Dbits;
-			v = 0;
-		}else{
-			v <<= m;
-		}
+		v = m < 64 ? (v<<m) : 0;
 		s = (Dbits - m) & (Dbits - 1);
 		v |= w >> s;
 		r = w & ((1ULL<<s) - 1);