diff options
-rw-r--r-- | mpf/int_p.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/mpf/int_p.c b/mpf/int_p.c index 91e62266b..6144b70e3 100644 --- a/mpf/int_p.c +++ b/mpf/int_p.c @@ -1,7 +1,7 @@ /* mpf_integer_p -- test whether an mpf is an integer */ /* -Copyright 2001, 2002 Free Software Foundation, Inc. +Copyright 2001, 2002, 2014 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -36,24 +36,15 @@ see https://www.gnu.org/licenses/. */ int mpf_integer_p (mpf_srcptr f) __GMP_NOTHROW { - mp_srcptr ptr; mp_exp_t exp; - mp_size_t size, frac, i; + mp_size_t size; size = SIZ (f); - if (size == 0) - return 1; /* zero is an integer */ - exp = EXP (f); if (exp <= 0) - return 0; /* has only fraction limbs */ + return (size == 0); /* zero is an integer, + others have only fraction limbs */ /* any fraction limbs must be zero */ - frac = ABS (size) - exp; - ptr = PTR (f); - for (i = 0; i < frac; i++) - if (ptr[i] != 0) - return 0; - - return 1; + return mpn_zero_p (PTR (f), ABS (size) - exp); } |