In writing some range-op entries I noticed we don't have a way to
query the sign of the NAN in a range, unless the range only contains
NAN, in which case you can just use frange::signbit_p. This patch
adds a method that returns TRUE if there exists the possiblity of a
NAN and we know its sign.
gcc/ChangeLog:
* value-range.h (frange::nan_signbit_p): New.
bool maybe_isnan (bool sign) const;
bool maybe_isinf () const;
bool signbit_p (bool &signbit) const;
+ bool nan_signbit_p (bool &signbit) const;
private:
void verify_range ();
bool normalize_kind ();
return false;
}
+// If range has a NAN with a known sign, set it in SIGNBIT and return
+// TRUE.
+
+inline bool
+frange::nan_signbit_p (bool &signbit) const
+{
+ if (undefined_p ())
+ return false;
+
+ if (m_pos_nan == m_neg_nan)
+ return false;
+
+ signbit = m_neg_nan;
+ return true;
+}
+
#endif // GCC_VALUE_RANGE_H