summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_add_d.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 13:18:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 13:18:17 (GMT)
commit7b09e3867d1705d3d223ae5383297ee336f03149 (patch)
tree1e099a70167b3b7184aaabfb9fc26fcfd45937f8 /libtommath/bn_mp_add_d.c
parentcbb0665d7d54dbcecf538a4c5564c6f233294a11 (diff)
downloadtcl-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.
Diffstat (limited to 'libtommath/bn_mp_add_d.c')
-rw-r--r--libtommath/bn_mp_add_d.c5
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);