summaryrefslogtreecommitdiff
path: root/mpz/get_d_2exp.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2012-06-24 20:01:48 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2012-06-24 20:01:48 +0200
commite0aedd501ac3527afde22e00bc2a690ea53b0cc8 (patch)
tree40545804dad8ccd0743580f33bcd82bd75c41cd8 /mpz/get_d_2exp.c
parent3ec113088e179c03184171188ef4133dd4786189 (diff)
downloadgmp-e0aedd501ac3527afde22e00bc2a690ea53b0cc8.tar.gz
Use MPN_SIZEINBASE_2EXP to count bits
Diffstat (limited to 'mpz/get_d_2exp.c')
-rw-r--r--mpz/get_d_2exp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mpz/get_d_2exp.c b/mpz/get_d_2exp.c
index c3cf60c9d..b2e2e51ce 100644
--- a/mpz/get_d_2exp.c
+++ b/mpz/get_d_2exp.c
@@ -1,6 +1,6 @@
/* double mpz_get_d_2exp (signed long int *exp, mpz_t src).
-Copyright 2001, 2003, 2004 Free Software Foundation, Inc.
+Copyright 2001, 2003, 2004, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -26,7 +26,6 @@ mpz_get_d_2exp (signed long int *exp2, mpz_srcptr src)
{
mp_size_t size, abs_size;
mp_srcptr ptr;
- int cnt;
long exp;
size = SIZ(src);
@@ -38,8 +37,7 @@ mpz_get_d_2exp (signed long int *exp2, mpz_srcptr src)
ptr = PTR(src);
abs_size = ABS(size);
- count_leading_zeros (cnt, ptr[abs_size - 1]);
- exp = abs_size * GMP_NUMB_BITS - (cnt - GMP_NAIL_BITS);
+ MPN_SIZEINBASE_2EXP(exp, ptr, abs_size, 1);
*exp2 = exp;
return mpn_get_d (ptr, abs_size, size, -exp);
}