From 35065b9127adf06b0a19286ff7ccc87f14cff10d Mon Sep 17 00:00:00 2001 From: aiju Date: Fri, 4 May 2018 21:41:16 +0000 Subject: [PATCH] mpmagadd: force output sign +1 always --- sys/src/libmp/port/mpadd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/src/libmp/port/mpadd.c b/sys/src/libmp/port/mpadd.c index 9a1ccde66..3672c2c34 100644 --- a/sys/src/libmp/port/mpadd.c +++ b/sys/src/libmp/port/mpadd.c @@ -21,10 +21,12 @@ mpmagadd(mpint *b1, mpint *b2, mpint *sum) m = b2->top; if(n == 0){ mpassign(mpzero, sum); + sum->sign = 1; return; } if(m == 0){ mpassign(b1, sum); + sum->sign = 1; return; } mpbits(sum, (n+1)*Dbits);