summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2014-06-02 08:38:02 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2014-06-02 08:38:02 +0200
commitc8a3e76bc27e2486920dc7751fbfa03136812be0 (patch)
treefc7267f7ab36e6dce6c79f27b1e26c33a0cb9513 /mpf
parent8c6ecacf075996730c75732b76aac5a21f718a3e (diff)
downloadgmp-c8a3e76bc27e2486920dc7751fbfa03136812be0.tar.gz
mpf/int_p.c: Delay zero branch, use mpn_zero_p
Diffstat (limited to 'mpf')
-rw-r--r--mpf/int_p.c19
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);
}