diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-09-17 19:55:44 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-11-06 11:37:02 +0100 |
commit | 3c7df4a0ff91a833cf77e38ab8ccd65e289242e9 (patch) | |
tree | 8b978ad87aa4c82615a9aafbcf114505617b1fe0 | |
parent | 7bf4f81de81b6e800509867d5acad545c566dbac (diff) |
Add support for a signaling NaN in qfloat16
There was a comment saying what value does the job, so might as well
put it to work.
Change-Id: I47f1a8ce7ce889580f71aa784ccbcc227ebe0b23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/global/qfloat16.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index c50fa36402..154b200475 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -95,7 +95,9 @@ public: static constexpr qfloat16 _limit_lowest() noexcept { return qfloat16(Wrap(0xfbff)); } static constexpr qfloat16 _limit_infinity() noexcept { return qfloat16(Wrap(0x7c00)); } static constexpr qfloat16 _limit_quiet_NaN() noexcept { return qfloat16(Wrap(0x7e00)); } - // Signalling NaN is 0x7f00 +#if QT_CONFIG(signaling_nan) + static constexpr qfloat16 _limit_signaling_NaN() noexcept { return qfloat16(Wrap(0x7f00)); } +#endif inline constexpr bool isNormal() const noexcept { return (b16 & 0x7fff) == 0 || ((b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00); } private: @@ -330,6 +332,12 @@ public: { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_infinity(); } static constexpr QT_PREPEND_NAMESPACE(qfloat16) quiet_NaN() { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_quiet_NaN(); } +#if QT_CONFIG(signaling_nan) + static constexpr QT_PREPEND_NAMESPACE(qfloat16) signaling_NaN() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_signaling_NaN(); } +#else + static constexpr bool has_signaling_NaN = false; +#endif }; template<> class numeric_limits<const QT_PREPEND_NAMESPACE(qfloat16)> |