diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-17 13:18:17 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-17 13:18:17 (GMT) |
commit | ca471eb7483c0847ccdd54d653511fd06ebef7df (patch) | |
tree | 1e099a70167b3b7184aaabfb9fc26fcfd45937f8 /libtommath | |
parent | 538960215f5f4a997697c5883187205825875944 (diff) | |
download | tcl-ca471eb7483c0847ccdd54d653511fd06ebef7df.zip tcl-ca471eb7483c0847ccdd54d653511fd06ebef7df.tar.gz tcl-ca471eb7483c0847ccdd54d653511fd06ebef7df.tar.bz2 |
Restore bn_mp_add_d.c to exact copy of libtommath-1.0 version: Since the mp_clamp() function already restores the sign of it's argument to positive if c->used ==0, it is not necessary to do that twice. Therefore, the original version of the code is correct.
Diffstat (limited to 'libtommath')
-rw-r--r-- | libtommath/bn_mp_add_d.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 26a165b..4d4e1df 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -37,9 +37,8 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* c = |a| - b */ res = mp_sub_d(a, b, c); - /* fix signs */ - a->sign = MP_NEG; - c->sign = (c->used) ? MP_NEG : MP_ZPOS; + /* fix sign */ + a->sign = c->sign = MP_NEG; /* clamp */ mp_clamp(c); |