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 | 7b09e3867d1705d3d223ae5383297ee336f03149 (patch) | |
tree | 1e099a70167b3b7184aaabfb9fc26fcfd45937f8 | |
parent | cbb0665d7d54dbcecf538a4c5564c6f233294a11 (diff) | |
download | tcl-7b09e3867d1705d3d223ae5383297ee336f03149.zip tcl-7b09e3867d1705d3d223ae5383297ee336f03149.tar.gz tcl-7b09e3867d1705d3d223ae5383297ee336f03149.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.
-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); |