summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_div_d.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-12-01 00:31:32 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-12-01 00:31:32 (GMT)
commite2b2a49eaf9b2b79351be7d294a10704a3e0061d (patch)
treeb91b425009b0142d260faab2301882de49e3f0f3 /libtommath/bn_mp_div_d.c
parent982d09f4d635271e2c515dbe49a9f44d1a42c59a (diff)
downloadtcl-e2b2a49eaf9b2b79351be7d294a10704a3e0061d.zip
tcl-e2b2a49eaf9b2b79351be7d294a10704a3e0061d.tar.gz
tcl-e2b2a49eaf9b2b79351be7d294a10704a3e0061d.tar.bz2
Upgrade to tommath 0.39 plus patches from Tom
Diffstat (limited to 'libtommath/bn_mp_div_d.c')
-rw-r--r--libtommath/bn_mp_div_d.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c
index 4f210e6..b12fb5c 100644
--- a/libtommath/bn_mp_div_d.c
+++ b/libtommath/bn_mp_div_d.c
@@ -19,6 +19,10 @@ static int s_is_power_of_two(mp_digit b, int *p)
{
int x;
+ /* quick out - if (b & (b-1)) isn't zero, b isn't a power of two */
+ if ( b & (b-1) != 0 ) {
+ return 0;
+ }
for (x = 1; x < DIGIT_BIT; x++) {
if (b == (((mp_digit)1)<<x)) {
*p = x;
@@ -106,5 +110,5 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
#endif
/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_div_d.c,v $ */
-/* $Revision: 1.1.1.3 $ */
-/* $Date: 2006/12/01 00:08:11 $ */
+/* $Revision: 1.2 $ */
+/* $Date: 2006/12/01 00:31:32 $ */