summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qfloat16.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-23 10:09:42 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-25 07:10:45 +0200
commitc2be9180b7430221e9136afb1a8c2a752ac2710f (patch)
tree5b390c53f4744c7bd4faeaf4d3a12d77ce3c0ba7 /src/corelib/global/qfloat16.h
parent31a1b3280cf076fcdb45a658d0140af3737be138 (diff)
Replace Q_REQUIRED_RESULT with [[nodiscard]]
It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qfloat16.h')
-rw-r--r--src/corelib/global/qfloat16.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 136571bbaf..9c6fb29e42 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -123,20 +123,20 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length)
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept;
// Complement qnumeric.h:
-Q_REQUIRED_RESULT inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); }
-Q_REQUIRED_RESULT inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); }
-Q_REQUIRED_RESULT inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); }
-Q_REQUIRED_RESULT inline int qFpClassify(qfloat16 f) noexcept { return f.fpClassify(); }
-// Q_REQUIRED_RESULT quint32 qFloatDistance(qfloat16 a, qfloat16 b);
+[[nodiscard]] inline bool qIsInf(qfloat16 f) noexcept { return f.isInf(); }
+[[nodiscard]] inline bool qIsNaN(qfloat16 f) noexcept { return f.isNaN(); }
+[[nodiscard]] inline bool qIsFinite(qfloat16 f) noexcept { return f.isFinite(); }
+[[nodiscard]] inline int qFpClassify(qfloat16 f) noexcept { return f.fpClassify(); }
+// [[nodiscard]] quint32 qFloatDistance(qfloat16 a, qfloat16 b);
// The remainder of these utility functions complement qglobal.h
-Q_REQUIRED_RESULT inline int qRound(qfloat16 d) noexcept
+[[nodiscard]] inline int qRound(qfloat16 d) noexcept
{ return qRound(static_cast<float>(d)); }
-Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) noexcept
+[[nodiscard]] inline qint64 qRound64(qfloat16 d) noexcept
{ return qRound64(static_cast<float>(d)); }
-Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
+[[nodiscard]] inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
{
float f1 = static_cast<float>(p1);
float f2 = static_cast<float>(p2);
@@ -149,7 +149,7 @@ Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2)));
}
-Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) noexcept
+[[nodiscard]] inline bool qIsNull(qfloat16 f) noexcept
{
return (f.b16 & static_cast<quint16>(0x7fff)) == 0;
}
@@ -301,7 +301,7 @@ QT_WARNING_POP
/*!
\internal
*/
-Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) noexcept
+[[nodiscard]] inline bool qFuzzyIsNull(qfloat16 f) noexcept
{
return qAbs(static_cast<float>(f)) <= 0.001f;
}