real.h (real_isinteger): Declare.
2006-11-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * real.h (real_isinteger): Declare. * real.c (real_isinteger): Define. * builtins.c (integer_valued_real_p): Use it. From-SVN: r119130
This commit is contained in:
parent
05170031ab
commit
313f234ba1
4 changed files with 21 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-11-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
* real.h (real_isinteger): Declare.
|
||||
* real.c (real_isinteger): Define.
|
||||
* builtins.c (integer_valued_real_p): Use it.
|
||||
|
||||
2006-11-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR c/9072
|
||||
|
|
|
@ -6677,15 +6677,7 @@ integer_valued_real_p (tree t)
|
|||
&& integer_valued_real_p (TREE_OPERAND (t, 2));
|
||||
|
||||
case REAL_CST:
|
||||
if (! TREE_CONSTANT_OVERFLOW (t))
|
||||
{
|
||||
REAL_VALUE_TYPE c, cint;
|
||||
|
||||
c = TREE_REAL_CST (t);
|
||||
real_trunc (&cint, TYPE_MODE (TREE_TYPE (t)), &c);
|
||||
return real_identical (&c, &cint);
|
||||
}
|
||||
break;
|
||||
return real_isinteger (TREE_REAL_CST_PTR (t), TYPE_MODE (TREE_TYPE (t)));
|
||||
|
||||
case NOP_EXPR:
|
||||
{
|
||||
|
|
11
gcc/real.c
11
gcc/real.c
|
@ -4968,3 +4968,14 @@ real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m)
|
|||
|
||||
real_from_string (r, buf);
|
||||
}
|
||||
|
||||
/* Check whether the real constant value given is an integer. */
|
||||
|
||||
bool
|
||||
real_isinteger (const REAL_VALUE_TYPE *c, enum machine_mode mode)
|
||||
{
|
||||
REAL_VALUE_TYPE cint;
|
||||
|
||||
real_trunc (&cint, mode, c);
|
||||
return real_identical (c, &cint);
|
||||
}
|
||||
|
|
|
@ -433,4 +433,7 @@ extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *);
|
|||
extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr);
|
||||
extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *);
|
||||
|
||||
/* Check whether the real constant value given is an integer. */
|
||||
extern bool real_isinteger (const REAL_VALUE_TYPE *c, enum machine_mode mode);
|
||||
|
||||
#endif /* ! GCC_REAL_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue