diff options
author | Kimmo Ollila <kimmo.ollila@qt.io> | 2017-02-05 13:52:48 +0200 |
---|---|---|
committer | Kimmo Ollila <kimmo.ollila@qt.io> | 2017-02-15 13:52:26 +0000 |
commit | a0a9e8b2d7038f95cf341f34e73ddc2468cc5a07 (patch) | |
tree | 0ae4ebff3c01cd158595bd247c8cd9ad11cca68d /src | |
parent | 5542e772d6e0690b7d8b3ac0ae591331401e871a (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qfloat16.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 5264b56104..1de1ae65fb 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -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. |