Fix is_iec559 assert on GHS compiler

GHS compiler is not fully compliant with iec559.
Therefore we need to replace is_iec559 assertion
with separate checks to build quint16.

Change-Id: I88c57e394b8d4e7899ee7d4a13cbfbac9436b2fc
Reviewed-by: Rolland Dudemaine <rolland@ghs.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Kimmo Ollila 2017-02-05 13:52:48 +02:00
parent 5542e772d6
commit a0a9e8b2d7
1 changed files with 13 additions and 0 deletions

View File

@ -61,8 +61,21 @@ QT_BEGIN_NAMESPACE
Q_STATIC_ASSERT_X(sizeof(float) == sizeof(quint32),
"qfloat16 assumes that floats are 32 bits wide");
// There are a few corner cases regarding denormals where GHS compiler is relying
// hardware behavior that is not IEC 559 compliant. Therefore the compiler
// reports std::numeric_limits<float>::is_iec559 as false. This is all right
// according to our needs.
#if !defined(Q_CC_GHS)
Q_STATIC_ASSERT_X(std::numeric_limits<float>::is_iec559,
"Only works with IEEE 754 floating point");
#endif
Q_STATIC_ASSERT_X(std::numeric_limits<float>::has_infinity &&
std::numeric_limits<float>::has_quiet_NaN &&
std::numeric_limits<float>::has_signaling_NaN,
"Only works with IEEE 754 floating point");
/*!
Returns true if the \c qfloat16 \a {f} is equivalent to infinity.