From a0a9e8b2d7038f95cf341f34e73ddc2468cc5a07 Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Sun, 5 Feb 2017 13:52:48 +0200 Subject: 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 Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/corelib/global/qfloat16.cpp') 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::is_iec559 as false. This is all right +// according to our needs. + +#if !defined(Q_CC_GHS) Q_STATIC_ASSERT_X(std::numeric_limits::is_iec559, "Only works with IEEE 754 floating point"); +#endif + +Q_STATIC_ASSERT_X(std::numeric_limits::has_infinity && + std::numeric_limits::has_quiet_NaN && + std::numeric_limits::has_signaling_NaN, + "Only works with IEEE 754 floating point"); /*! Returns true if the \c qfloat16 \a {f} is equivalent to infinity. -- cgit v1.2.3