summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_add_d.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 16:12:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-17 16:12:14 (GMT)
commit8d1caeae4dbe404a28c14bdc0bc3a8e97f6eaaf2 (patch)
treece84219a5932e60edc4b6d0a8b9ee60cb721f33b /libtommath/bn_mp_add_d.c
parent99fd1215e29a440df99afb1b967c6e91faffa7c6 (diff)
downloadtcl-8d1caeae4dbe404a28c14bdc0bc3a8e97f6eaaf2.zip
tcl-8d1caeae4dbe404a28c14bdc0bc3a8e97f6eaaf2.tar.gz
tcl-8d1caeae4dbe404a28c14bdc0bc3a8e97f6eaaf2.tar.bz2
Fix libtommath's mp_radix_size() function such that it returns 2 for single-digit numbers. Add testcases for mp_radix_size() and mp_iseven(). Undo useless change in bn_mp_add_d.c (bring back libtommath's version).
Diffstat (limited to 'libtommath/bn_mp_add_d.c')
-rw-r--r--libtommath/bn_mp_add_d.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c
index 5281ad4..aec8fc8 100644
--- a/libtommath/bn_mp_add_d.c
+++ b/libtommath/bn_mp_add_d.c
@@ -12,7 +12,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
+ * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
/* single digit addition */
@@ -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);
@@ -107,3 +106,7 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
}
#endif
+
+/* $Source$ */
+/* $Revision: 0.41 $ */
+/* $Date: 2007-04-18 09:58:18 +0000 $ */