diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-06-24 20:01:48 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-06-24 20:01:48 +0200 |
commit | e0aedd501ac3527afde22e00bc2a690ea53b0cc8 (patch) | |
tree | 40545804dad8ccd0743580f33bcd82bd75c41cd8 /mpz/get_d_2exp.c | |
parent | 3ec113088e179c03184171188ef4133dd4786189 (diff) | |
download | gmp-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.c | 6 |
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); } |