ref: da0d11ebf1f9bce6672a14ff4a7ab9d851be85f1
parent: 3581e6f7261122ff2176bbcac7f792758ac4d144
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jan 5 22:47:22 EST 2025
mptod: don't shift by 64
--- a/3rd/mp/mptod.c
+++ b/3rd/mp/mptod.c
@@ -7,7 +7,8 @@
{
uint64_t v;
mpdigit w, r;
- int sf, i, n, m, s;
+ int sf, i, n;
+ uint32_t m, s;
FPdbleword x;
if(a->top == 0) return 0.0;
@@ -29,9 +30,14 @@
else
w = a->p[i];
m = 54 - n;
- if(m > Dbits) m = Dbits;
+ if(m > Dbits){
+ m = Dbits;
+ v = 0;
+ }else{
+ v <<= m;
+ }
s = Dbits - m & Dbits - 1;
- v = v << m | w >> s;
+ v |= w >> s;
r = w & (1ULL<<s) - 1;
n += m;
}