summaryrefslogtreecommitdiff
path: root/mpf
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2013-03-19 22:06:09 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2013-03-19 22:06:09 +0100
commitaf0d079b81cd5f6d9cd780b6a5fab05258b0a74f (patch)
tree5dc0a34688e7155222216c1e8ee8317b9b504ef7 /mpf
parent0187231697a0e80b47325b9b6c65cca23332d9ff (diff)
downloadgmp-af0d079b81cd5f6d9cd780b6a5fab05258b0a74f.tar.gz
mpf/fits_u.h: accept numbers truncating to zero before checking the sign.
Diffstat (limited to 'mpf')
-rw-r--r--mpf/fits_u.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/mpf/fits_u.h b/mpf/fits_u.h
index 4503f037f..adc596d96 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 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -31,14 +31,14 @@ FUNCTION (mpf_srcptr f) __GMP_NOTHROW
mp_exp_t exp;
mp_limb_t fl;
+ exp = EXP(f);
+ if (exp < 1)
+ return 1; /* -1 < f < 1 truncates to zero, so fits */
+
fn = SIZ(f);
if (fn <= 0)
return fn == 0; /* zero fits, negatives don't */
- exp = EXP(f);
- if (exp < 1)
- return 1; /* 0 < f < 1 truncates to zero, so fits */
-
fp = PTR(f);
if (exp == 1)