diff options
-rw-r--r-- | mpf/fits_s.h | 7 | ||||
-rw-r--r-- | mpf/fits_u.h | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/mpf/fits_s.h b/mpf/fits_s.h index ec2635f65..25f323e25 100644 --- a/mpf/fits_s.h +++ b/mpf/fits_s.h @@ -1,6 +1,6 @@ /* mpf_fits_s*_p -- test whether an mpf fits a C signed type. -Copyright 2001, 2002 Free Software Foundation, Inc. +Copyright 2001, 2002, 2014 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -42,14 +42,11 @@ FUNCTION (mpf_srcptr f) __GMP_NOTHROW mp_exp_t exp; mp_limb_t fl; - fs = SIZ(f); - if (fs == 0) - return 1; /* zero fits */ - exp = EXP(f); if (exp < 1) return 1; /* -1 < f < 1 truncates to zero, so fits */ + fs = SIZ (f); fp = PTR(f); fn = ABS (fs); diff --git a/mpf/fits_u.h b/mpf/fits_u.h index 65ac60e09..be7a271b2 100644 --- a/mpf/fits_u.h +++ b/mpf/fits_u.h @@ -1,6 +1,6 @@ /* mpf_fits_u*_p -- test whether an mpf fits a C unsigned type. -Copyright 2001, 2002, 2013 Free Software Foundation, Inc. +Copyright 2001, 2002, 2013, 2014 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -47,8 +47,8 @@ FUNCTION (mpf_srcptr f) __GMP_NOTHROW return 1; /* -1 < f < 1 truncates to zero, so fits */ fn = SIZ(f); - if (fn <= 0) - return fn == 0; /* zero fits, negatives don't */ + if (fn < 0) /* zero catched by exp == 0 */ + return 0; /* negatives don't fit */ fp = PTR(f); |