mpmagadd: force output sign +1 always

This commit is contained in:
aiju 2018-05-04 21:41:16 +00:00
parent 8dc43a951c
commit 35065b9127

View file

@ -21,10 +21,12 @@ mpmagadd(mpint *b1, mpint *b2, mpint *sum)
m = b2->top; m = b2->top;
if(n == 0){ if(n == 0){
mpassign(mpzero, sum); mpassign(mpzero, sum);
sum->sign = 1;
return; return;
} }
if(m == 0){ if(m == 0){
mpassign(b1, sum); mpassign(b1, sum);
sum->sign = 1;
return; return;
} }
mpbits(sum, (n+1)*Dbits); mpbits(sum, (n+1)*Dbits);