summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-02-15 00:14:45 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-02-15 00:14:45 +0000
commit67d7ed79a38548a407ea6a997877e67f68279d53 (patch)
tree2cfbeae247768207db48b7638c51b2cf56b8aea1 /gcc/real.c
parent556a5e8d7c42ac43304f02e77e89fbdba5de35be (diff)
downloadgcc-67d7ed79a38548a407ea6a997877e67f68279d53.tar.gz
(eifrac): If FIXUNS_TRUNC_LIKE_FIX_TRUNC, convert on positive overflow
as if unsigned. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6554 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/gcc/real.c b/gcc/real.c
index db36bfe8a6e..ea89ef80787 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1,8 +1,7 @@
/* real.c - implementation of REAL_ARITHMETIC, REAL_VALUE_ATOF,
and support for XFmode IEEE extended real floating point arithmetic.
- Contributed by Stephen L. Moshier (moshier@world.std.com).
-
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Contributed by Stephen L. Moshier (moshier@world.std.com).
This file is part of GNU CC.
@@ -3822,16 +3821,13 @@ ultoe (lp, y)
}
-/*
-; Find signed HOST_WIDE_INT integer and floating point fractional parts
-
-; HOST_WIDE_INT i;
-; unsigned EMUSHORT x[NE], frac[NE];
-; xifrac (x, &i, frac);
+/* Find signed HOST_WIDE_INT integer and floating point fractional
+ parts of e-type (packed internal format) floating point input X.
+ The integer output I has the sign of the input, except that
+ positive overflow is permitted if FIXUNS_TRUNC_LIKE_FIX_TRUNC.
+ The output e-type fraction FRAC is the positive fractional
+ part of abs (X). */
- The integer output has the sign of the input. The fraction is
-the positive fractional part of abs (x).
-*/
void
eifrac (x, i, frac)
unsigned EMUSHORT *x;
@@ -3858,7 +3854,17 @@ eifrac (x, i, frac)
if (xi[0])
*i = ((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1);
else
- *i = (((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1)) - 1;
+ {
+#ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
+ /* In this case, let it overflow and convert as if unsigned. */
+ euifrac (x, &ll, frac);
+ *i = (HOST_WIDE_INT) ll;
+ return;
+#else
+ /* In other cases, return the largest positive integer. */
+ *i = (((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1)) - 1;
+#endif
+ }
eshift (xi, k);
if (extra_warnings)
warning ("overflow on truncation to integer");