Commit c764eafd by Richard Kenner

(eifrac): If FIXUNS_TRUNC_LIKE_FIX_TRUNC, convert on positive overflow

as if unsigned.

From-SVN: r6554
parent 7aaf8abb
/* real.c - implementation of REAL_ARITHMETIC, REAL_VALUE_ATOF, /* real.c - implementation of REAL_ARITHMETIC, REAL_VALUE_ATOF,
and support for XFmode IEEE extended real floating point arithmetic. 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. Copyright (C) 1993, 1994 Free Software Foundation, Inc.
Contributed by Stephen L. Moshier (moshier@world.std.com).
This file is part of GNU CC. This file is part of GNU CC.
...@@ -3822,16 +3821,13 @@ ultoe (lp, y) ...@@ -3822,16 +3821,13 @@ ultoe (lp, y)
} }
/* /* Find signed HOST_WIDE_INT integer and floating point fractional
; Find signed HOST_WIDE_INT integer and floating point fractional parts parts of e-type (packed internal format) floating point input X.
The integer output I has the sign of the input, except that
; HOST_WIDE_INT i; positive overflow is permitted if FIXUNS_TRUNC_LIKE_FIX_TRUNC.
; unsigned EMUSHORT x[NE], frac[NE]; The output e-type fraction FRAC is the positive fractional
; xifrac (x, &i, frac); part of abs (X). */
The integer output has the sign of the input. The fraction is
the positive fractional part of abs (x).
*/
void void
eifrac (x, i, frac) eifrac (x, i, frac)
unsigned EMUSHORT *x; unsigned EMUSHORT *x;
...@@ -3858,7 +3854,17 @@ eifrac (x, i, frac) ...@@ -3858,7 +3854,17 @@ eifrac (x, i, frac)
if (xi[0]) if (xi[0])
*i = ((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1); *i = ((unsigned HOST_WIDE_INT) 1) << (HOST_BITS_PER_WIDE_INT - 1);
else 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); eshift (xi, k);
if (extra_warnings) if (extra_warnings)
warning ("overflow on truncation to integer"); warning ("overflow on truncation to integer");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment