summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_radix_size.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-18 09:50:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-18 09:50:37 (GMT)
commit13a2801fd71cf3c45131e929852f100259df6eaf (patch)
treec945d6b5352f04dfb8dcda9435522ae38bf25c51 /libtommath/bn_mp_radix_size.c
parent995aaf8bfd5f8a4eff19f4704eb29d67dcab3605 (diff)
parent1be35f340f98dc2d8ff29d5d5c1fc4709f424fc8 (diff)
downloadtcl-13a2801fd71cf3c45131e929852f100259df6eaf.zip
tcl-13a2801fd71cf3c45131e929852f100259df6eaf.tar.gz
tcl-13a2801fd71cf3c45131e929852f100259df6eaf.tar.bz2
Fix [e6f27aa56fa51bfc1752ce768bf0d301c60bfd2c|e6f27aa56f]: Update libtommath to 1.0
Diffstat (limited to 'libtommath/bn_mp_radix_size.c')
-rw-r--r--libtommath/bn_mp_radix_size.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c
index 9d95c48..d4a02e8 100644
--- a/libtommath/bn_mp_radix_size.c
+++ b/libtommath/bn_mp_radix_size.c
@@ -1,4 +1,4 @@
-#include <tommath.h>
+#include <tommath_private.h>
#ifdef BN_MP_RADIX_SIZE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
@@ -12,11 +12,11 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://libtom.org
+ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
/* returns size of ASCII reprensentation */
-int mp_radix_size (mp_int * a, int radix, int *size)
+int mp_radix_size (const mp_int * a, int radix, int *size)
{
int res, digs;
mp_int t;
@@ -24,14 +24,8 @@ int mp_radix_size (mp_int * a, int radix, int *size)
*size = 0;
- /* special case for binary */
- if (radix == 2) {
- *size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1;
- return MP_OKAY;
- }
-
/* make sure the radix is in range */
- if (radix < 2 || radix > 64) {
+ if ((radix < 2) || (radix > 64)) {
return MP_VAL;
}
@@ -40,6 +34,12 @@ int mp_radix_size (mp_int * a, int radix, int *size)
return MP_OKAY;
}
+ /* special case for binary */
+ if (radix == 2) {
+ *size = mp_count_bits (a) + ((a->sign == MP_NEG) ? 1 : 0) + 1;
+ return MP_OKAY;
+ }
+
/* digs is the digit count */
digs = 0;
@@ -74,5 +74,5 @@ int mp_radix_size (mp_int * a, int radix, int *size)
#endif
/* $Source$ */
-/* $Revision: 0.41 $ */
-/* $Date: 2007-04-18 09:58:18 +0000 $ */
+/* $Revision$ */
+/* $Date$ */