summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_radix_size.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)
commit3aefaf62e4de2181582277bb60fe2a4ee5c506a2 (patch)
treece84219a5932e60edc4b6d0a8b9ee60cb721f33b /libtommath/bn_mp_radix_size.c
parenta9263ba9069329f5c9f64a6a965cfce12f18ab15 (diff)
downloadtcl-3aefaf62e4de2181582277bb60fe2a4ee5c506a2.zip
tcl-3aefaf62e4de2181582277bb60fe2a4ee5c506a2.tar.gz
tcl-3aefaf62e4de2181582277bb60fe2a4ee5c506a2.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_radix_size.c')
-rw-r--r--libtommath/bn_mp_radix_size.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c
index 40c4d04..9d95c48 100644
--- a/libtommath/bn_mp_radix_size.c
+++ b/libtommath/bn_mp_radix_size.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
*/
/* returns size of ASCII reprensentation */
@@ -66,18 +66,13 @@ int mp_radix_size (mp_int * a, int radix, int *size)
}
mp_clear (&t);
- /*
- * return digs + 1, the 1 is for the NULL byte that would be required.
- * mp_toradix_n requires a minimum of 3 bytes, so never report less than
- * that.
- */
-
- if ( digs >= 2 ) {
- *size = digs + 1;
- } else {
- *size = 3;
- }
+ /* return digs + 1, the 1 is for the NULL byte that would be required. */
+ *size = digs + 1;
return MP_OKAY;
}
#endif
+
+/* $Source$ */
+/* $Revision: 0.41 $ */
+/* $Date: 2007-04-18 09:58:18 +0000 $ */