summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qfloat16.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-09-17 19:53:55 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-11-06 11:36:49 +0100
commit7bf4f81de81b6e800509867d5acad545c566dbac (patch)
tree4528d7e30048a0a4da872d5c7528c7f3ea6b4dac /src/corelib/global/qfloat16.h
parentb7858e9b4bdb2866f0c76ecaa8dd25bd9b618afc (diff)
Add qfloat16::copySign() since we can't overload std::copysign()
Change-Id: Idfaf841b3eb3538f076ae4f0de2d7d029e1588fe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qfloat16.h')
-rw-r--r--src/corelib/global/qfloat16.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 9a4f1800a4..c50fa36402 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -84,6 +84,9 @@ public:
bool isNaN() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7e; }
bool isFinite() const noexcept { return ((b16 >> 8) & 0x7c) != 0x7c; }
Q_CORE_EXPORT int fpClassify() const noexcept;
+ // Can't specialize std::copysign() for qfloat16
+ qfloat16 copySign(qfloat16 sign) const noexcept
+ { return qfloat16(Wrap((sign.b16 & 0x8000) | (b16 & 0x7fff))); }
// Support for std::numeric_limits<qfloat16>
static constexpr qfloat16 _limit_epsilon() noexcept { return qfloat16(Wrap(0x1400)); }
static constexpr qfloat16 _limit_min() noexcept { return qfloat16(Wrap(0x400)); }