shithub: riscv

Download patch

ref: 609a9922adac98516b33d67dc98b432ac9c10cc9
parent: 87abbc649f9064660128b840ef3aabad3e55abce
author: aiju <devnull@localhost>
date: Tue Dec 8 14:43:22 EST 2015

mp: fix bug in mplogic.c; update mkfile

--- a/sys/src/libmp/port/mkfile
+++ b/sys/src/libmp/port/mkfile
@@ -38,6 +38,7 @@
 	mptoui\
 	mptov\
 	mptouv\
+	mplogic\
 
 ALLOFILES=${FILES:%=%.$O}
 # cull things in the per-machine directories from this list
--- a/sys/src/libmp/port/mplogic.c
+++ b/sys/src/libmp/port/mplogic.c
@@ -138,7 +138,6 @@
 	r->top = DIGITS(n);
 	d = n / Dbits;
 	m = n % Dbits;
-	r->sign = 1;
 	if(b->sign == -1){
 		c = 1;
 		for(i = 0; i <= r->top; i++){
@@ -162,6 +161,7 @@
 		if(m != 0)
 			r->p[d] = b->p[d] & (1<<m)-1;
 	}
+	r->sign = 1;
 	mpnorm(r);
 }