diff options
Diffstat (limited to 'src/corelib/global/qfloat16.cpp')
-rw-r--r-- | src/corelib/global/qfloat16.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 680268c59b..68763c0606 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2016 by Southwest Research Institute (R) ** Contact: http://www.qt-project.org/legal ** @@ -39,6 +40,7 @@ #include "qfloat16.h" #include "private/qsimd_p.h" +#include <cmath> // for fpclassify()'s return values QT_BEGIN_NAMESPACE @@ -65,6 +67,19 @@ QT_BEGIN_NAMESPACE */ /*! + \macro QT_NO_FLOAT16_OPERATORS + \relates <QFloat16> + \since 5.12.4 + + Defining this macro disables the arithmetic operators for qfloat16. + + This is only necessary on Visual Studio 2017 (and earlier) when including + \c {<QFloat16>} and \c{<bitset>} in the same translation unit, which would + otherwise cause a compilation error due to a toolchain bug (see + [QTBUG-72073]). +*/ + +/*! \fn bool qIsInf(qfloat16 f) \relates <QFloat16> @@ -91,6 +106,17 @@ QT_BEGIN_NAMESPACE \sa qIsFinite */ +/*! + \internal + Implements qFpClassify() for qfloat16. + */ + +int qfloat16::fpClassify() const noexcept +{ + return isInf() ? FP_INFINITE : isNaN() ? FP_NAN + : !b16 ? FP_ZERO : isNormal() ? FP_NORMAL : FP_SUBNORMAL; +} + /*! \fn int qRound(qfloat16 value) \relates <QFloat16> |