shithub: riscv

Download patch

ref: 344ff48512561b57022c1f686005b3283da07cc5
parent: cf2f2a884137b589f502ffc7af9de5ca78634356
author: aiju <devnull@localhost>
date: Sun Aug 28 07:38:29 EDT 2016

mp: fix mptov and mptouv

--- a/sys/src/libmp/port/mptouv.c
+++ b/sys/src/libmp/port/mptouv.c
@@ -14,10 +14,10 @@
 	int s;
 
 	if(b == nil){
-		b = mpnew(VLDIGITS*sizeof(mpdigit));
+		b = mpnew(VLDIGITS*Dbits);
 		setmalloctag(b, getcallerpc(&v));
 	}else
-		mpbits(b, VLDIGITS*sizeof(mpdigit));
+		mpbits(b, VLDIGITS*Dbits);
 	b->sign = 1;
 	for(s = 0; s < VLDIGITS; s++){
 		b->p[s] = v;
--- a/sys/src/libmp/port/mptov.c
+++ b/sys/src/libmp/port/mptov.c
@@ -15,10 +15,10 @@
 	uvlong uv;
 
 	if(b == nil){
-		b = mpnew(VLDIGITS*sizeof(mpdigit));
+		b = mpnew(VLDIGITS*Dbits);
 		setmalloctag(b, getcallerpc(&v));
 	}else
-		mpbits(b, VLDIGITS*sizeof(mpdigit));
+		mpbits(b, VLDIGITS*Dbits);
 	b->sign = (v >> (sizeof(v)*8 - 1)) | 1;
 	uv = v * b->sign;
 	for(s = 0; s < VLDIGITS; s++){