diff options
Diffstat (limited to 'src/corelib/global')
33 files changed, 3927 insertions, 388 deletions
diff --git a/src/corelib/global/archdetect.cpp b/src/corelib/global/archdetect.cpp index 66a5e074f6..1d00b7f5a5 100644 --- a/src/corelib/global/archdetect.cpp +++ b/src/corelib/global/archdetect.cpp @@ -67,6 +67,10 @@ # define ARCH_PROCESSOR "power" #elif defined(Q_PROCESSOR_POWER_64) # define ARCH_PROCESSOR "power64" +#elif defined(Q_PROCESSOR_RISCV_32) +# define ARCH_PROCESSOR "riscv32" +#elif defined(Q_PROCESSOR_RISCV_64) +# define ARCH_PROCESSOR "riscv64" #elif defined(Q_PROCESSOR_S390_X) # define ARCH_PROCESSOR "s390x" #elif defined(Q_PROCESSOR_S390) diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 029357ff43..1da69aba9b 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -7,12 +7,12 @@ HEADERS += \ global/qsystemdetection.h \ global/qcompilerdetection.h \ global/qprocessordetection.h \ + global/qmemory_p.h \ global/qnamespace.h \ global/qendian.h \ global/qendian_p.h \ global/qnumeric_p.h \ global/qnumeric.h \ - global/qfloat16_p.h \ global/qfloat16.h \ global/qglobalstatic.h \ global/qlibraryinfo.h \ @@ -40,6 +40,10 @@ SOURCES += \ global/qrandom.cpp \ global/qhooks.cpp +# To get listed in IDEs +false: SOURCES += \ + global/qfloat16tables.cpp + # Only add global/qfloat16_f16c.c if qfloat16.cpp can't #include it. # Any compiler: if it is already generating F16C code, let qfloat16.cpp do it # Clang: ICE if not generating F16C code, so use qfloat16_f16c.c @@ -124,14 +128,3 @@ gcc:ltcg { } else { SOURCES += $$VERSIONTAGGING_SOURCES } - -QMAKE_QFLOAT16_TABLES_GENERATE = global/qfloat16.h - -qtPrepareTool(QMAKE_QFLOAT16_TABLES, qfloat16-tables) - -qfloat16_tables.commands = $$QMAKE_QFLOAT16_TABLES ${QMAKE_FILE_OUT} -qfloat16_tables.output = global/qfloat16tables.cpp -qfloat16_tables.depends = $$QMAKE_QFLOAT16_TABLES_EXE -qfloat16_tables.input = QMAKE_QFLOAT16_TABLES_GENERATE -qfloat16_tables.variable_out = SOURCES -QMAKE_EXTRA_COMPILERS += qfloat16_tables diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 345ab9e8ad..e47f284a42 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -110,12 +110,6 @@ # define Q_CC_INTEL __INTEL_COMPILER # endif -/* only defined for MSVC since that's the only compiler that actually optimizes for this */ -/* might get overridden further down when Q_COMPILER_NOEXCEPT is detected */ -# ifdef __cplusplus -# define Q_DECL_NOTHROW throw() -# endif - #elif defined(__BORLANDC__) || defined(__TURBOC__) # define Q_CC_BOR # define Q_INLINE_TEMPLATE @@ -1128,16 +1122,11 @@ #ifdef Q_COMPILER_NOEXCEPT # define Q_DECL_NOEXCEPT noexcept # define Q_DECL_NOEXCEPT_EXPR(x) noexcept(x) -# ifdef Q_DECL_NOTHROW -# undef Q_DECL_NOTHROW /* override with C++11 noexcept if available */ -# endif #else # define Q_DECL_NOEXCEPT # define Q_DECL_NOEXCEPT_EXPR(x) #endif -#ifndef Q_DECL_NOTHROW -# define Q_DECL_NOTHROW Q_DECL_NOEXCEPT -#endif +#define Q_DECL_NOTHROW Q_DECL_NOEXCEPT #if defined(Q_COMPILER_ALIGNOF) # undef Q_ALIGNOF diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index e9fee5f23e..bd3c219968 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -42,9 +42,7 @@ #ifndef QFLAGS_H #define QFLAGS_H -#ifdef Q_COMPILER_INITIALIZER_LISTS #include <initializer_list> -#endif QT_BEGIN_NAMESPACE @@ -54,21 +52,21 @@ class QFlag { int i; public: - Q_DECL_CONSTEXPR inline QFlag(int value) Q_DECL_NOTHROW : i(value) {} - Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; } + Q_DECL_CONSTEXPR inline QFlag(int value) noexcept : i(value) {} + Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; } #if !defined(Q_CC_MSVC) // Microsoft Visual Studio has buggy behavior when it comes to // unsigned enums: even if the enum is unsigned, the enum tags are // always signed # if !defined(__LP64__) && !defined(Q_CLANG_QDOC) - Q_DECL_CONSTEXPR inline QFlag(long value) Q_DECL_NOTHROW : i(int(value)) {} - Q_DECL_CONSTEXPR inline QFlag(ulong value) Q_DECL_NOTHROW : i(int(long(value))) {} + Q_DECL_CONSTEXPR inline QFlag(long value) noexcept : i(int(value)) {} + Q_DECL_CONSTEXPR inline QFlag(ulong value) noexcept : i(int(long(value))) {} # endif - Q_DECL_CONSTEXPR inline QFlag(uint value) Q_DECL_NOTHROW : i(int(value)) {} - Q_DECL_CONSTEXPR inline QFlag(short value) Q_DECL_NOTHROW : i(int(value)) {} - Q_DECL_CONSTEXPR inline QFlag(ushort value) Q_DECL_NOTHROW : i(int(uint(value))) {} - Q_DECL_CONSTEXPR inline operator uint() const Q_DECL_NOTHROW { return uint(i); } + Q_DECL_CONSTEXPR inline QFlag(uint value) noexcept : i(int(value)) {} + Q_DECL_CONSTEXPR inline QFlag(short value) noexcept : i(int(value)) {} + Q_DECL_CONSTEXPR inline QFlag(ushort value) noexcept : i(int(uint(value))) {} + Q_DECL_CONSTEXPR inline operator uint() const noexcept { return uint(i); } #endif }; Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE); @@ -77,12 +75,12 @@ class QIncompatibleFlag { int i; public: - Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; } + Q_DECL_CONSTEXPR inline explicit QIncompatibleFlag(int i) noexcept; + Q_DECL_CONSTEXPR inline operator int() const noexcept { return i; } }; Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE); -Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) Q_DECL_NOTHROW : i(value) {} +Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) noexcept : i(value) {} #ifndef Q_NO_TYPESAFE_FLAGS @@ -117,51 +115,47 @@ public: Q_DECL_CONSTEXPR inline QFlags(const QFlags &other); Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif - Q_DECL_CONSTEXPR inline QFlags(Enum flags) Q_DECL_NOTHROW : i(Int(flags)) {} - Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} - Q_DECL_CONSTEXPR inline QFlags(QFlag flag) Q_DECL_NOTHROW : i(flag) {} + Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {} + Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) noexcept : i(0) {} + Q_DECL_CONSTEXPR inline QFlags(QFlag flag) noexcept : i(flag) {} -#ifdef Q_COMPILER_INITIALIZER_LISTS - Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) Q_DECL_NOTHROW + Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) noexcept : i(initializer_list_helper(flags.begin(), flags.end())) {} -#endif - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) Q_DECL_NOTHROW { i &= mask; return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) Q_DECL_NOTHROW { i &= mask; return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) Q_DECL_NOTHROW { i &= Int(mask); return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) Q_DECL_NOTHROW { i |= other.i; return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) Q_DECL_NOTHROW { i |= Int(other); return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) Q_DECL_NOTHROW { i ^= other.i; return *this; } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) Q_DECL_NOTHROW { i ^= Int(other); return *this; } - - Q_DECL_CONSTEXPR inline operator Int() const Q_DECL_NOTHROW { return i; } - - Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | other.i)); } - Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | Int(other))); } - Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ other.i)); } - Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ Int(other))); } - Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); } - Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); } - Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i & Int(other))); } - Q_DECL_CONSTEXPR inline QFlags operator~() const Q_DECL_NOTHROW { return QFlags(QFlag(~i)); } - - Q_DECL_CONSTEXPR inline bool operator!() const Q_DECL_NOTHROW { return !i; } - - Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const Q_DECL_NOTHROW { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); } - Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) Q_DECL_NOTHROW + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) noexcept { i &= mask; return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) noexcept { i &= mask; return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) noexcept { i &= Int(mask); return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) noexcept { i |= other.i; return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) noexcept { i |= Int(other); return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) noexcept { i ^= other.i; return *this; } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) noexcept { i ^= Int(other); return *this; } + + Q_DECL_CONSTEXPR inline operator Int() const noexcept { return i; } + + Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const noexcept { return QFlags(QFlag(i | other.i)); } + Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const noexcept { return QFlags(QFlag(i | Int(other))); } + Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const noexcept { return QFlags(QFlag(i ^ other.i)); } + Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const noexcept { return QFlags(QFlag(i ^ Int(other))); } + Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const noexcept { return QFlags(QFlag(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const noexcept { return QFlags(QFlag(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const noexcept { return QFlags(QFlag(i & Int(other))); } + Q_DECL_CONSTEXPR inline QFlags operator~() const noexcept { return QFlags(QFlag(~i)); } + + Q_DECL_CONSTEXPR inline bool operator!() const noexcept { return !i; } + + Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const noexcept { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); } + Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) noexcept { return on ? (*this |= flag) : (*this &= ~Int(flag)); } private: -#ifdef Q_COMPILER_INITIALIZER_LISTS Q_DECL_CONSTEXPR static inline Int initializer_list_helper(typename std::initializer_list<Enum>::const_iterator it, typename std::initializer_list<Enum>::const_iterator end) - Q_DECL_NOTHROW + noexcept { return (it == end ? Int(0) : (Int(*it) | initializer_list_helper(it + 1, end))); } -#endif Int i; }; @@ -172,13 +166,13 @@ typedef QFlags<Enum> Flags; #endif #define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \ -Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW \ +Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \ { return QIncompatibleFlag(int(f1) | f2); } #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ -Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) Q_DECL_NOTHROW \ +Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \ { return QFlags<Flags::enum_type>(f1) | f2; } \ -Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW \ +Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) noexcept \ { return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 87ff796368..ff2997b73a 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 ** @@ -37,8 +38,9 @@ ** ****************************************************************************/ -#include "qfloat16_p.h" +#include "qfloat16.h" #include "private/qsimd_p.h" +#include <cmath> // for fpclassify()'s return values QT_BEGIN_NAMESPACE @@ -78,28 +80,42 @@ QT_BEGIN_NAMESPACE */ /*! - Returns true if the \c qfloat16 \a {f} is equivalent to infinity. + \fn bool qIsInf(qfloat16 f) \relates <QFloat16> + Returns true if the \c qfloat16 \a {f} is equivalent to infinity. + \sa qIsInf */ -Q_REQUIRED_RESULT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW { return qt_is_inf(f); } /*! - Returns true if the \c qfloat16 \a {f} is not a number (NaN). + \fn bool qIsNaN(qfloat16 f) \relates <QFloat16> + Returns true if the \c qfloat16 \a {f} is not a number (NaN). + \sa qIsNaN */ -Q_REQUIRED_RESULT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW { return qt_is_nan(f); } /*! - Returns true if the \c qfloat16 \a {f} is a finite number. + \fn bool qIsFinite(qfloat16 f) \relates <QFloat16> + Returns true if the \c qfloat16 \a {f} is a finite number. + \sa qIsFinite */ -Q_REQUIRED_RESULT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW { return qt_is_finite(f); } + +/*! + \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> @@ -142,8 +158,8 @@ extern "C" { # define f16cextern extern #endif -f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW; -f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW; +f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept; +f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept; #undef f16cextern } @@ -154,7 +170,7 @@ static inline bool hasFastF16() return true; } -static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW +static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) noexcept { __fp16 *out_f16 = reinterpret_cast<__fp16 *>(out); qsizetype i = 0; @@ -164,7 +180,7 @@ static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q out_f16[i] = __fp16(in[i]); } -static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW +static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) noexcept { const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in); qsizetype i = 0; @@ -179,12 +195,12 @@ static inline bool hasFastF16() return false; } -static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW +static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) noexcept { Q_UNREACHABLE(); } -static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW +static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) noexcept { Q_UNREACHABLE(); } @@ -196,7 +212,7 @@ static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_N Converts \a len floats from \a in to qfloat16 and stores them in \a out. Both \a in and \a out must have \a len allocated entries. */ -Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW +Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) noexcept { if (hasFastF16()) return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len); @@ -212,7 +228,7 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len Converts \a len qfloat16 from \a in to floats and stores them in \a out. Both \a in and \a out must have \a len allocated entries. */ -Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW +Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) noexcept { if (hasFastF16()) return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len); @@ -223,6 +239,7 @@ Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype l QT_END_NAMESPACE +#include "qfloat16tables.cpp" #ifdef QFLOAT16_INCLUDE_FAST # include "qfloat16_f16c.c" #endif diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index fc006db3f2..4d1aa91349 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -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 ** @@ -66,13 +67,37 @@ QT_BEGIN_NAMESPACE class qfloat16 { + struct Wrap + { + // To let our private constructor work, without other code seeing + // ambiguity when constructing from int, double &c. + quint16 b16; + constexpr inline explicit Wrap(int value) : b16(value) {} + }; public: - Q_DECL_CONSTEXPR inline qfloat16() Q_DECL_NOTHROW : b16(0) { } - inline qfloat16(float f) Q_DECL_NOTHROW; - inline operator float() const Q_DECL_NOTHROW; - + constexpr inline qfloat16() noexcept : b16(0) {} + inline qfloat16(float f) noexcept; + inline operator float() const noexcept; + + // Support for qIs{Inf,NaN,Finite}: + bool isInf() const noexcept { return ((b16 >> 8) & 0x7e) == 0x7c; } + 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; + // 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)); } + static constexpr qfloat16 _limit_denorm_min() noexcept { return qfloat16(Wrap(1)); } + static constexpr qfloat16 _limit_max() noexcept { return qfloat16(Wrap(0x7bff)); } + 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 + inline constexpr bool isNormal() const noexcept + { return b16 == 0 || ((b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00); } private: quint16 b16; + constexpr inline explicit qfloat16(Wrap nibble) noexcept : b16(nibble.b16) {} Q_CORE_EXPORT static const quint32 mantissatable[]; Q_CORE_EXPORT static const quint32 exponenttable[]; @@ -80,29 +105,32 @@ private: Q_CORE_EXPORT static const quint32 basetable[]; Q_CORE_EXPORT static const quint32 shifttable[]; - friend bool qIsNull(qfloat16 f) Q_DECL_NOTHROW; + friend bool qIsNull(qfloat16 f) noexcept; #if !defined(QT_NO_FLOAT16_OPERATORS) - friend qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW; + friend qfloat16 operator-(qfloat16 a) noexcept; #endif }; Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE); -Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW; -Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW; +Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) noexcept; +Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h -Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h -Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h +// 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); // The remainder of these utility functions complement qglobal.h -Q_REQUIRED_RESULT inline int qRound(qfloat16 d) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline int qRound(qfloat16 d) noexcept { return qRound(static_cast<float>(d)); } -Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline qint64 qRound64(qfloat16 d) noexcept { return qRound64(static_cast<float>(d)); } -Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept { float f1 = static_cast<float>(p1); float f2 = static_cast<float>(p2); @@ -115,19 +143,19 @@ Q_REQUIRED_RESULT inline bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) Q_DECL_NOT return (qAbs(f1 - f2) * 102.5f <= qMin(qAbs(f1), qAbs(f2))); } -Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool qIsNull(qfloat16 f) noexcept { return (f.b16 & static_cast<quint16>(0x7fff)) == 0; } -inline int qIntCast(qfloat16 f) Q_DECL_NOTHROW +inline int qIntCast(qfloat16 f) noexcept { return int(static_cast<float>(f)); } #ifndef Q_QDOC QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wc99-extensions") QT_WARNING_DISABLE_GCC("-Wold-style-cast") -inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW +inline qfloat16::qfloat16(float f) noexcept { #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) __m128 packsingle = _mm_set_ss(f); @@ -145,7 +173,7 @@ inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW } QT_WARNING_POP -inline qfloat16::operator float() const Q_DECL_NOTHROW +inline qfloat16::operator float() const noexcept { #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) __m128i packhalf = _mm_cvtsi32_si128(b16); @@ -166,23 +194,23 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW #endif #if !defined(QT_NO_FLOAT16_OPERATORS) -inline qfloat16 operator-(qfloat16 a) Q_DECL_NOTHROW +inline qfloat16 operator-(qfloat16 a) noexcept { qfloat16 f; f.b16 = a.b16 ^ quint16(0x8000); return f; } -inline qfloat16 operator+(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); } -inline qfloat16 operator-(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); } -inline qfloat16 operator*(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); } -inline qfloat16 operator/(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); } +inline qfloat16 operator+(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) + static_cast<float>(b)); } +inline qfloat16 operator-(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) - static_cast<float>(b)); } +inline qfloat16 operator*(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) * static_cast<float>(b)); } +inline qfloat16 operator/(qfloat16 a, qfloat16 b) noexcept { return qfloat16(static_cast<float>(a) / static_cast<float>(b)); } #define QF16_MAKE_ARITH_OP_FP(FP, OP) \ - inline FP operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \ - inline FP operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); } + inline FP operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \ + inline FP operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); } #define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \ - inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) Q_DECL_NOTHROW \ + inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) noexcept \ { lhs = qfloat16(float(static_cast<FP>(lhs) OP rhs)); return lhs; } #define QF16_MAKE_ARITH_OP(FP) \ QF16_MAKE_ARITH_OP_FP(FP, +) \ @@ -200,8 +228,8 @@ QF16_MAKE_ARITH_OP(float) #undef QF16_MAKE_ARITH_OP_FP #define QF16_MAKE_ARITH_OP_INT(OP) \ - inline double operator OP(qfloat16 lhs, int rhs) Q_DECL_NOTHROW { return static_cast<double>(lhs) OP rhs; } \ - inline double operator OP(int lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<double>(rhs); } + inline double operator OP(qfloat16 lhs, int rhs) noexcept { return static_cast<double>(lhs) OP rhs; } \ + inline double operator OP(int lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<double>(rhs); } QF16_MAKE_ARITH_OP_INT(+) QF16_MAKE_ARITH_OP_INT(-) QF16_MAKE_ARITH_OP_INT(*) @@ -212,16 +240,16 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wfloat-equal") QT_WARNING_DISABLE_GCC("-Wfloat-equal") -inline bool operator>(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) > static_cast<float>(b); } -inline bool operator<(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) < static_cast<float>(b); } -inline bool operator>=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) >= static_cast<float>(b); } -inline bool operator<=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) <= static_cast<float>(b); } -inline bool operator==(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) == static_cast<float>(b); } -inline bool operator!=(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return static_cast<float>(a) != static_cast<float>(b); } +inline bool operator>(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) > static_cast<float>(b); } +inline bool operator<(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) < static_cast<float>(b); } +inline bool operator>=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) >= static_cast<float>(b); } +inline bool operator<=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) <= static_cast<float>(b); } +inline bool operator==(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) == static_cast<float>(b); } +inline bool operator!=(qfloat16 a, qfloat16 b) noexcept { return static_cast<float>(a) != static_cast<float>(b); } #define QF16_MAKE_BOOL_OP_FP(FP, OP) \ - inline bool operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast<FP>(lhs) OP rhs; } \ - inline bool operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast<FP>(rhs); } + inline bool operator OP(qfloat16 lhs, FP rhs) noexcept { return static_cast<FP>(lhs) OP rhs; } \ + inline bool operator OP(FP lhs, qfloat16 rhs) noexcept { return lhs OP static_cast<FP>(rhs); } #define QF16_MAKE_BOOL_OP(FP) \ QF16_MAKE_BOOL_OP_FP(FP, <) \ QF16_MAKE_BOOL_OP_FP(FP, >) \ @@ -236,8 +264,8 @@ QF16_MAKE_BOOL_OP(float) #undef QF16_MAKE_BOOL_OP_FP #define QF16_MAKE_BOOL_OP_INT(OP) \ - inline bool operator OP(qfloat16 a, int b) Q_DECL_NOTHROW { return static_cast<float>(a) OP b; } \ - inline bool operator OP(int a, qfloat16 b) Q_DECL_NOTHROW { return a OP static_cast<float>(b); } + inline bool operator OP(qfloat16 a, int b) noexcept { return static_cast<float>(a) OP b; } \ + inline bool operator OP(int a, qfloat16 b) noexcept { return a OP static_cast<float>(b); } QF16_MAKE_BOOL_OP_INT(>) QF16_MAKE_BOOL_OP_INT(<) QF16_MAKE_BOOL_OP_INT(>=) @@ -252,7 +280,7 @@ QT_WARNING_POP /*! \internal */ -Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool qFuzzyIsNull(qfloat16 f) noexcept { return qAbs(static_cast<float>(f)) <= 0.001f; } @@ -261,4 +289,55 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(qfloat16) +namespace std { +template<> +class numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> : public numeric_limits<float> +{ +public: + /* + Treat quint16 b16 as if it were: + uint S: 1; // b16 >> 15 (sign) + uint E: 5; // (b16 >> 10) & 0x1f (offset exponent) + uint M: 10; // b16 & 0x3ff (adjusted mantissa) + + for E == 0: magnitude is M / 2.^{24} + for 0 < E < 31: magnitude is (1. + M / 2.^{10}) * 2.^{E - 15) + for E == 31: not finite + */ + static constexpr int digits = 11; + static constexpr int min_exponent = -13; + static constexpr int max_exponent = 16; + + static constexpr int digits10 = 3; + static constexpr int max_digits10 = 5; + static constexpr int min_exponent10 = -4; + static constexpr int max_exponent10 = 4; + + static constexpr QT_PREPEND_NAMESPACE(qfloat16) epsilon() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_epsilon(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) (min)() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_min(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) denorm_min() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_denorm_min(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) (max)() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_max(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) lowest() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_lowest(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) infinity() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_infinity(); } + static constexpr QT_PREPEND_NAMESPACE(qfloat16) quiet_NaN() + { return QT_PREPEND_NAMESPACE(qfloat16)::_limit_quiet_NaN(); } +}; + +template<> class numeric_limits<const QT_PREPEND_NAMESPACE(qfloat16)> + : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {}; +template<> class numeric_limits<volatile QT_PREPEND_NAMESPACE(qfloat16)> + : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {}; +template<> class numeric_limits<const volatile QT_PREPEND_NAMESPACE(qfloat16)> + : public numeric_limits<QT_PREPEND_NAMESPACE(qfloat16)> {}; + +// Adding overloads to std isn't allowed, so we can't extend this to support +// for fpclassify(), isnormal() &c. (which, furthermore, are macros on MinGW). +} // namespace std + #endif // QFLOAT16_H diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c index a7eadc71b7..ba1e16f481 100644 --- a/src/corelib/global/qfloat16_f16c.c +++ b/src/corelib/global/qfloat16_f16c.c @@ -54,7 +54,7 @@ extern "C" { #endif QT_FUNCTION_TARGET(F16C) -void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW +void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOEXCEPT { qsizetype i = 0; int epilog_i; @@ -70,7 +70,7 @@ void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_N } QT_FUNCTION_TARGET(F16C) -void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW +void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOEXCEPT { qsizetype i = 0; int epilog_i; diff --git a/src/corelib/global/qfloat16tables.cpp b/src/corelib/global/qfloat16tables.cpp new file mode 100644 index 0000000000..3d764937d7 --- /dev/null +++ b/src/corelib/global/qfloat16tables.cpp @@ -0,0 +1,3266 @@ +/**************************************************************************** +** +** Copyright (C) 2016 by Southwest Research Institute (R) +** Copyright (C) 2019 Intel Corporation. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* This file was generated by gen_qfloat16_tables.cpp */ + +#include <QtCore/qfloat16.h> + +QT_BEGIN_NAMESPACE + +#if !defined(__F16C__) && !defined(__ARM_FP16_FORMAT_IEEE) + +const quint32 qfloat16::mantissatable[2048] = { +0, +0x33800000U, +0x34000000U, +0x34400000U, +0x34800000U, +0x34A00000U, +0x34C00000U, +0x34E00000U, +0x35000000U, +0x35100000U, +0x35200000U, +0x35300000U, +0x35400000U, +0x35500000U, +0x35600000U, +0x35700000U, +0x35800000U, +0x35880000U, +0x35900000U, +0x35980000U, +0x35A00000U, +0x35A80000U, +0x35B00000U, +0x35B80000U, +0x35C00000U, +0x35C80000U, +0x35D00000U, +0x35D80000U, +0x35E00000U, +0x35E80000U, +0x35F00000U, +0x35F80000U, +0x36000000U, +0x36040000U, +0x36080000U, +0x360C0000U, +0x36100000U, +0x36140000U, +0x36180000U, +0x361C0000U, +0x36200000U, +0x36240000U, +0x36280000U, +0x362C0000U, +0x36300000U, +0x36340000U, +0x36380000U, +0x363C0000U, +0x36400000U, +0x36440000U, +0x36480000U, +0x364C0000U, +0x36500000U, +0x36540000U, +0x36580000U, +0x365C0000U, +0x36600000U, +0x36640000U, +0x36680000U, +0x366C0000U, +0x36700000U, +0x36740000U, +0x36780000U, +0x367C0000U, +0x36800000U, +0x36820000U, +0x36840000U, +0x36860000U, +0x36880000U, +0x368A0000U, +0x368C0000U, +0x368E0000U, +0x36900000U, +0x36920000U, +0x36940000U, +0x36960000U, +0x36980000U, +0x369A0000U, +0x369C0000U, +0x369E0000U, +0x36A00000U, +0x36A20000U, +0x36A40000U, +0x36A60000U, +0x36A80000U, +0x36AA0000U, +0x36AC0000U, +0x36AE0000U, +0x36B00000U, +0x36B20000U, +0x36B40000U, +0x36B60000U, +0x36B80000U, +0x36BA0000U, +0x36BC0000U, +0x36BE0000U, +0x36C00000U, +0x36C20000U, +0x36C40000U, +0x36C60000U, +0x36C80000U, +0x36CA0000U, +0x36CC0000U, +0x36CE0000U, +0x36D00000U, +0x36D20000U, +0x36D40000U, +0x36D60000U, +0x36D80000U, +0x36DA0000U, +0x36DC0000U, +0x36DE0000U, +0x36E00000U, +0x36E20000U, +0x36E40000U, +0x36E60000U, +0x36E80000U, +0x36EA0000U, +0x36EC0000U, +0x36EE0000U, +0x36F00000U, +0x36F20000U, +0x36F40000U, +0x36F60000U, +0x36F80000U, +0x36FA0000U, +0x36FC0000U, +0x36FE0000U, +0x37000000U, +0x37010000U, +0x37020000U, +0x37030000U, +0x37040000U, +0x37050000U, +0x37060000U, +0x37070000U, +0x37080000U, +0x37090000U, +0x370A0000U, +0x370B0000U, +0x370C0000U, +0x370D0000U, +0x370E0000U, +0x370F0000U, +0x37100000U, +0x37110000U, +0x37120000U, +0x37130000U, +0x37140000U, +0x37150000U, +0x37160000U, +0x37170000U, +0x37180000U, +0x37190000U, +0x371A0000U, +0x371B0000U, +0x371C0000U, +0x371D0000U, +0x371E0000U, +0x371F0000U, +0x37200000U, +0x37210000U, +0x37220000U, +0x37230000U, +0x37240000U, +0x37250000U, +0x37260000U, +0x37270000U, +0x37280000U, +0x37290000U, +0x372A0000U, +0x372B0000U, +0x372C0000U, +0x372D0000U, +0x372E0000U, +0x372F0000U, +0x37300000U, +0x37310000U, +0x37320000U, +0x37330000U, +0x37340000U, +0x37350000U, +0x37360000U, +0x37370000U, +0x37380000U, +0x37390000U, +0x373A0000U, +0x373B0000U, +0x373C0000U, +0x373D0000U, +0x373E0000U, +0x373F0000U, +0x37400000U, +0x37410000U, +0x37420000U, +0x37430000U, +0x37440000U, +0x37450000U, +0x37460000U, +0x37470000U, +0x37480000U, +0x37490000U, +0x374A0000U, +0x374B0000U, +0x374C0000U, +0x374D0000U, +0x374E0000U, +0x374F0000U, +0x37500000U, +0x37510000U, +0x37520000U, +0x37530000U, +0x37540000U, +0x37550000U, +0x37560000U, +0x37570000U, +0x37580000U, +0x37590000U, +0x375A0000U, +0x375B0000U, +0x375C0000U, +0x375D0000U, +0x375E0000U, +0x375F0000U, +0x37600000U, +0x37610000U, +0x37620000U, +0x37630000U, +0x37640000U, +0x37650000U, +0x37660000U, +0x37670000U, +0x37680000U, +0x37690000U, +0x376A0000U, +0x376B0000U, +0x376C0000U, +0x376D0000U, +0x376E0000U, +0x376F0000U, +0x37700000U, +0x37710000U, +0x37720000U, +0x37730000U, +0x37740000U, +0x37750000U, +0x37760000U, +0x37770000U, +0x37780000U, +0x37790000U, +0x377A0000U, +0x377B0000U, +0x377C0000U, +0x377D0000U, +0x377E0000U, +0x377F0000U, +0x37800000U, +0x37808000U, +0x37810000U, +0x37818000U, +0x37820000U, +0x37828000U, +0x37830000U, +0x37838000U, +0x37840000U, +0x37848000U, +0x37850000U, +0x37858000U, +0x37860000U, +0x37868000U, +0x37870000U, +0x37878000U, +0x37880000U, +0x37888000U, +0x37890000U, +0x37898000U, +0x378A0000U, +0x378A8000U, +0x378B0000U, +0x378B8000U, +0x378C0000U, +0x378C8000U, +0x378D0000U, +0x378D8000U, +0x378E0000U, +0x378E8000U, +0x378F0000U, +0x378F8000U, +0x37900000U, +0x37908000U, +0x37910000U, +0x37918000U, +0x37920000U, +0x37928000U, +0x37930000U, +0x37938000U, +0x37940000U, +0x37948000U, +0x37950000U, +0x37958000U, +0x37960000U, +0x37968000U, +0x37970000U, +0x37978000U, +0x37980000U, +0x37988000U, +0x37990000U, +0x37998000U, +0x379A0000U, +0x379A8000U, +0x379B0000U, +0x379B8000U, +0x379C0000U, +0x379C8000U, +0x379D0000U, +0x379D8000U, +0x379E0000U, +0x379E8000U, +0x379F0000U, +0x379F8000U, +0x37A00000U, +0x37A08000U, +0x37A10000U, +0x37A18000U, +0x37A20000U, +0x37A28000U, +0x37A30000U, +0x37A38000U, +0x37A40000U, +0x37A48000U, +0x37A50000U, +0x37A58000U, +0x37A60000U, +0x37A68000U, +0x37A70000U, +0x37A78000U, +0x37A80000U, +0x37A88000U, +0x37A90000U, +0x37A98000U, +0x37AA0000U, +0x37AA8000U, +0x37AB0000U, +0x37AB8000U, +0x37AC0000U, +0x37AC8000U, +0x37AD0000U, +0x37AD8000U, +0x37AE0000U, +0x37AE8000U, +0x37AF0000U, +0x37AF8000U, +0x37B00000U, +0x37B08000U, +0x37B10000U, +0x37B18000U, +0x37B20000U, +0x37B28000U, +0x37B30000U, +0x37B38000U, +0x37B40000U, +0x37B48000U, +0x37B50000U, +0x37B58000U, +0x37B60000U, +0x37B68000U, +0x37B70000U, +0x37B78000U, +0x37B80000U, +0x37B88000U, +0x37B90000U, +0x37B98000U, +0x37BA0000U, +0x37BA8000U, +0x37BB0000U, +0x37BB8000U, +0x37BC0000U, +0x37BC8000U, +0x37BD0000U, +0x37BD8000U, +0x37BE0000U, +0x37BE8000U, +0x37BF0000U, +0x37BF8000U, +0x37C00000U, +0x37C08000U, +0x37C10000U, +0x37C18000U, +0x37C20000U, +0x37C28000U, +0x37C30000U, +0x37C38000U, +0x37C40000U, +0x37C48000U, +0x37C50000U, +0x37C58000U, +0x37C60000U, +0x37C68000U, +0x37C70000U, +0x37C78000U, +0x37C80000U, +0x37C88000U, +0x37C90000U, +0x37C98000U, +0x37CA0000U, +0x37CA8000U, +0x37CB0000U, +0x37CB8000U, +0x37CC0000U, +0x37CC8000U, +0x37CD0000U, +0x37CD8000U, +0x37CE0000U, +0x37CE8000U, +0x37CF0000U, +0x37CF8000U, +0x37D00000U, +0x37D08000U, +0x37D10000U, +0x37D18000U, +0x37D20000U, +0x37D28000U, +0x37D30000U, +0x37D38000U, +0x37D40000U, +0x37D48000U, +0x37D50000U, +0x37D58000U, +0x37D60000U, +0x37D68000U, +0x37D70000U, +0x37D78000U, +0x37D80000U, +0x37D88000U, +0x37D90000U, +0x37D98000U, +0x37DA0000U, +0x37DA8000U, +0x37DB0000U, +0x37DB8000U, +0x37DC0000U, +0x37DC8000U, +0x37DD0000U, +0x37DD8000U, +0x37DE0000U, +0x37DE8000U, +0x37DF0000U, +0x37DF8000U, +0x37E00000U, +0x37E08000U, +0x37E10000U, +0x37E18000U, +0x37E20000U, +0x37E28000U, +0x37E30000U, +0x37E38000U, +0x37E40000U, +0x37E48000U, +0x37E50000U, +0x37E58000U, +0x37E60000U, +0x37E68000U, +0x37E70000U, +0x37E78000U, +0x37E80000U, +0x37E88000U, +0x37E90000U, +0x37E98000U, +0x37EA0000U, +0x37EA8000U, +0x37EB0000U, +0x37EB8000U, +0x37EC0000U, +0x37EC8000U, +0x37ED0000U, +0x37ED8000U, +0x37EE0000U, +0x37EE8000U, +0x37EF0000U, +0x37EF8000U, +0x37F00000U, +0x37F08000U, +0x37F10000U, +0x37F18000U, +0x37F20000U, +0x37F28000U, +0x37F30000U, +0x37F38000U, +0x37F40000U, +0x37F48000U, +0x37F50000U, +0x37F58000U, +0x37F60000U, +0x37F68000U, +0x37F70000U, +0x37F78000U, +0x37F80000U, +0x37F88000U, +0x37F90000U, +0x37F98000U, +0x37FA0000U, +0x37FA8000U, +0x37FB0000U, +0x37FB8000U, +0x37FC0000U, +0x37FC8000U, +0x37FD0000U, +0x37FD8000U, +0x37FE0000U, +0x37FE8000U, +0x37FF0000U, +0x37FF8000U, +0x38000000U, +0x38004000U, +0x38008000U, +0x3800C000U, +0x38010000U, +0x38014000U, +0x38018000U, +0x3801C000U, +0x38020000U, +0x38024000U, +0x38028000U, +0x3802C000U, +0x38030000U, +0x38034000U, +0x38038000U, +0x3803C000U, +0x38040000U, +0x38044000U, +0x38048000U, +0x3804C000U, +0x38050000U, +0x38054000U, +0x38058000U, +0x3805C000U, +0x38060000U, +0x38064000U, +0x38068000U, +0x3806C000U, +0x38070000U, +0x38074000U, +0x38078000U, +0x3807C000U, +0x38080000U, +0x38084000U, +0x38088000U, +0x3808C000U, +0x38090000U, +0x38094000U, +0x38098000U, +0x3809C000U, +0x380A0000U, +0x380A4000U, +0x380A8000U, +0x380AC000U, +0x380B0000U, +0x380B4000U, +0x380B8000U, +0x380BC000U, +0x380C0000U, +0x380C4000U, +0x380C8000U, +0x380CC000U, +0x380D0000U, +0x380D4000U, +0x380D8000U, +0x380DC000U, +0x380E0000U, +0x380E4000U, +0x380E8000U, +0x380EC000U, +0x380F0000U, +0x380F4000U, +0x380F8000U, +0x380FC000U, +0x38100000U, +0x38104000U, +0x38108000U, +0x3810C000U, +0x38110000U, +0x38114000U, +0x38118000U, +0x3811C000U, +0x38120000U, +0x38124000U, +0x38128000U, +0x3812C000U, +0x38130000U, +0x38134000U, +0x38138000U, +0x3813C000U, +0x38140000U, +0x38144000U, +0x38148000U, +0x3814C000U, +0x38150000U, +0x38154000U, +0x38158000U, +0x3815C000U, +0x38160000U, +0x38164000U, +0x38168000U, +0x3816C000U, +0x38170000U, +0x38174000U, +0x38178000U, +0x3817C000U, +0x38180000U, +0x38184000U, +0x38188000U, +0x3818C000U, +0x38190000U, +0x38194000U, +0x38198000U, +0x3819C000U, +0x381A0000U, +0x381A4000U, +0x381A8000U, +0x381AC000U, +0x381B0000U, +0x381B4000U, +0x381B8000U, +0x381BC000U, +0x381C0000U, +0x381C4000U, +0x381C8000U, +0x381CC000U, +0x381D0000U, +0x381D4000U, +0x381D8000U, +0x381DC000U, +0x381E0000U, +0x381E4000U, +0x381E8000U, +0x381EC000U, +0x381F0000U, +0x381F4000U, +0x381F8000U, +0x381FC000U, +0x38200000U, +0x38204000U, +0x38208000U, +0x3820C000U, +0x38210000U, +0x38214000U, +0x38218000U, +0x3821C000U, +0x38220000U, +0x38224000U, +0x38228000U, +0x3822C000U, +0x38230000U, +0x38234000U, +0x38238000U, +0x3823C000U, +0x38240000U, +0x38244000U, +0x38248000U, +0x3824C000U, +0x38250000U, +0x38254000U, +0x38258000U, +0x3825C000U, +0x38260000U, +0x38264000U, +0x38268000U, +0x3826C000U, +0x38270000U, +0x38274000U, +0x38278000U, +0x3827C000U, +0x38280000U, +0x38284000U, +0x38288000U, +0x3828C000U, +0x38290000U, +0x38294000U, +0x38298000U, +0x3829C000U, +0x382A0000U, +0x382A4000U, +0x382A8000U, +0x382AC000U, +0x382B0000U, +0x382B4000U, +0x382B8000U, +0x382BC000U, +0x382C0000U, +0x382C4000U, +0x382C8000U, +0x382CC000U, +0x382D0000U, +0x382D4000U, +0x382D8000U, +0x382DC000U, +0x382E0000U, +0x382E4000U, +0x382E8000U, +0x382EC000U, +0x382F0000U, +0x382F4000U, +0x382F8000U, +0x382FC000U, +0x38300000U, +0x38304000U, +0x38308000U, +0x3830C000U, +0x38310000U, +0x38314000U, +0x38318000U, +0x3831C000U, +0x38320000U, +0x38324000U, +0x38328000U, +0x3832C000U, +0x38330000U, +0x38334000U, +0x38338000U, +0x3833C000U, +0x38340000U, +0x38344000U, +0x38348000U, +0x3834C000U, +0x38350000U, +0x38354000U, +0x38358000U, +0x3835C000U, +0x38360000U, +0x38364000U, +0x38368000U, +0x3836C000U, +0x38370000U, +0x38374000U, +0x38378000U, +0x3837C000U, +0x38380000U, +0x38384000U, +0x38388000U, +0x3838C000U, +0x38390000U, +0x38394000U, +0x38398000U, +0x3839C000U, +0x383A0000U, +0x383A4000U, +0x383A8000U, +0x383AC000U, +0x383B0000U, +0x383B4000U, +0x383B8000U, +0x383BC000U, +0x383C0000U, +0x383C4000U, +0x383C8000U, +0x383CC000U, +0x383D0000U, +0x383D4000U, +0x383D8000U, +0x383DC000U, +0x383E0000U, +0x383E4000U, +0x383E8000U, +0x383EC000U, +0x383F0000U, +0x383F4000U, +0x383F8000U, +0x383FC000U, +0x38400000U, +0x38404000U, +0x38408000U, +0x3840C000U, +0x38410000U, +0x38414000U, +0x38418000U, +0x3841C000U, +0x38420000U, +0x38424000U, +0x38428000U, +0x3842C000U, +0x38430000U, +0x38434000U, +0x38438000U, +0x3843C000U, +0x38440000U, +0x38444000U, +0x38448000U, +0x3844C000U, +0x38450000U, +0x38454000U, +0x38458000U, +0x3845C000U, +0x38460000U, +0x38464000U, +0x38468000U, +0x3846C000U, +0x38470000U, +0x38474000U, +0x38478000U, +0x3847C000U, +0x38480000U, +0x38484000U, +0x38488000U, +0x3848C000U, +0x38490000U, +0x38494000U, +0x38498000U, +0x3849C000U, +0x384A0000U, +0x384A4000U, +0x384A8000U, +0x384AC000U, +0x384B0000U, +0x384B4000U, +0x384B8000U, +0x384BC000U, +0x384C0000U, +0x384C4000U, +0x384C8000U, +0x384CC000U, +0x384D0000U, +0x384D4000U, +0x384D8000U, +0x384DC000U, +0x384E0000U, +0x384E4000U, +0x384E8000U, +0x384EC000U, +0x384F0000U, +0x384F4000U, +0x384F8000U, +0x384FC000U, +0x38500000U, +0x38504000U, +0x38508000U, +0x3850C000U, +0x38510000U, +0x38514000U, +0x38518000U, +0x3851C000U, +0x38520000U, +0x38524000U, +0x38528000U, +0x3852C000U, +0x38530000U, +0x38534000U, +0x38538000U, +0x3853C000U, +0x38540000U, +0x38544000U, +0x38548000U, +0x3854C000U, +0x38550000U, +0x38554000U, +0x38558000U, +0x3855C000U, +0x38560000U, +0x38564000U, +0x38568000U, +0x3856C000U, +0x38570000U, +0x38574000U, +0x38578000U, +0x3857C000U, +0x38580000U, +0x38584000U, +0x38588000U, +0x3858C000U, +0x38590000U, +0x38594000U, +0x38598000U, +0x3859C000U, +0x385A0000U, +0x385A4000U, +0x385A8000U, +0x385AC000U, +0x385B0000U, +0x385B4000U, +0x385B8000U, +0x385BC000U, +0x385C0000U, +0x385C4000U, +0x385C8000U, +0x385CC000U, +0x385D0000U, +0x385D4000U, +0x385D8000U, +0x385DC000U, +0x385E0000U, +0x385E4000U, +0x385E8000U, +0x385EC000U, +0x385F0000U, +0x385F4000U, +0x385F8000U, +0x385FC000U, +0x38600000U, +0x38604000U, +0x38608000U, +0x3860C000U, +0x38610000U, +0x38614000U, +0x38618000U, +0x3861C000U, +0x38620000U, +0x38624000U, +0x38628000U, +0x3862C000U, +0x38630000U, +0x38634000U, +0x38638000U, +0x3863C000U, +0x38640000U, +0x38644000U, +0x38648000U, +0x3864C000U, +0x38650000U, +0x38654000U, +0x38658000U, +0x3865C000U, +0x38660000U, +0x38664000U, +0x38668000U, +0x3866C000U, +0x38670000U, +0x38674000U, +0x38678000U, +0x3867C000U, +0x38680000U, +0x38684000U, +0x38688000U, +0x3868C000U, +0x38690000U, +0x38694000U, +0x38698000U, +0x3869C000U, +0x386A0000U, +0x386A4000U, +0x386A8000U, +0x386AC000U, +0x386B0000U, +0x386B4000U, +0x386B8000U, +0x386BC000U, +0x386C0000U, +0x386C4000U, +0x386C8000U, +0x386CC000U, +0x386D0000U, +0x386D4000U, +0x386D8000U, +0x386DC000U, +0x386E0000U, +0x386E4000U, +0x386E8000U, +0x386EC000U, +0x386F0000U, +0x386F4000U, +0x386F8000U, +0x386FC000U, +0x38700000U, +0x38704000U, +0x38708000U, +0x3870C000U, +0x38710000U, +0x38714000U, +0x38718000U, +0x3871C000U, +0x38720000U, +0x38724000U, +0x38728000U, +0x3872C000U, +0x38730000U, +0x38734000U, +0x38738000U, +0x3873C000U, +0x38740000U, +0x38744000U, +0x38748000U, +0x3874C000U, +0x38750000U, +0x38754000U, +0x38758000U, +0x3875C000U, +0x38760000U, +0x38764000U, +0x38768000U, +0x3876C000U, +0x38770000U, +0x38774000U, +0x38778000U, +0x3877C000U, +0x38780000U, +0x38784000U, +0x38788000U, +0x3878C000U, +0x38790000U, +0x38794000U, +0x38798000U, +0x3879C000U, +0x387A0000U, +0x387A4000U, +0x387A8000U, +0x387AC000U, +0x387B0000U, +0x387B4000U, +0x387B8000U, +0x387BC000U, +0x387C0000U, +0x387C4000U, +0x387C8000U, +0x387CC000U, +0x387D0000U, +0x387D4000U, +0x387D8000U, +0x387DC000U, +0x387E0000U, +0x387E4000U, +0x387E8000U, +0x387EC000U, +0x387F0000U, +0x387F4000U, +0x387F8000U, +0x387FC000U, +0x38000000U, +0x38002000U, +0x38004000U, +0x38006000U, +0x38008000U, +0x3800A000U, +0x3800C000U, +0x3800E000U, +0x38010000U, +0x38012000U, +0x38014000U, +0x38016000U, +0x38018000U, +0x3801A000U, +0x3801C000U, +0x3801E000U, +0x38020000U, +0x38022000U, +0x38024000U, +0x38026000U, +0x38028000U, +0x3802A000U, +0x3802C000U, +0x3802E000U, +0x38030000U, +0x38032000U, +0x38034000U, +0x38036000U, +0x38038000U, +0x3803A000U, +0x3803C000U, +0x3803E000U, +0x38040000U, +0x38042000U, +0x38044000U, +0x38046000U, +0x38048000U, +0x3804A000U, +0x3804C000U, +0x3804E000U, +0x38050000U, +0x38052000U, +0x38054000U, +0x38056000U, +0x38058000U, +0x3805A000U, +0x3805C000U, +0x3805E000U, +0x38060000U, +0x38062000U, +0x38064000U, +0x38066000U, +0x38068000U, +0x3806A000U, +0x3806C000U, +0x3806E000U, +0x38070000U, +0x38072000U, +0x38074000U, +0x38076000U, +0x38078000U, +0x3807A000U, +0x3807C000U, +0x3807E000U, +0x38080000U, +0x38082000U, +0x38084000U, +0x38086000U, +0x38088000U, +0x3808A000U, +0x3808C000U, +0x3808E000U, +0x38090000U, +0x38092000U, +0x38094000U, +0x38096000U, +0x38098000U, +0x3809A000U, +0x3809C000U, +0x3809E000U, +0x380A0000U, +0x380A2000U, +0x380A4000U, +0x380A6000U, +0x380A8000U, +0x380AA000U, +0x380AC000U, +0x380AE000U, +0x380B0000U, +0x380B2000U, +0x380B4000U, +0x380B6000U, +0x380B8000U, +0x380BA000U, +0x380BC000U, +0x380BE000U, +0x380C0000U, +0x380C2000U, +0x380C4000U, +0x380C6000U, +0x380C8000U, +0x380CA000U, +0x380CC000U, +0x380CE000U, +0x380D0000U, +0x380D2000U, +0x380D4000U, +0x380D6000U, +0x380D8000U, +0x380DA000U, +0x380DC000U, +0x380DE000U, +0x380E0000U, +0x380E2000U, +0x380E4000U, +0x380E6000U, +0x380E8000U, +0x380EA000U, +0x380EC000U, +0x380EE000U, +0x380F0000U, +0x380F2000U, +0x380F4000U, +0x380F6000U, +0x380F8000U, +0x380FA000U, +0x380FC000U, +0x380FE000U, +0x38100000U, +0x38102000U, +0x38104000U, +0x38106000U, +0x38108000U, +0x3810A000U, +0x3810C000U, +0x3810E000U, +0x38110000U, +0x38112000U, +0x38114000U, +0x38116000U, +0x38118000U, +0x3811A000U, +0x3811C000U, +0x3811E000U, +0x38120000U, +0x38122000U, +0x38124000U, +0x38126000U, +0x38128000U, +0x3812A000U, +0x3812C000U, +0x3812E000U, +0x38130000U, +0x38132000U, +0x38134000U, +0x38136000U, +0x38138000U, +0x3813A000U, +0x3813C000U, +0x3813E000U, +0x38140000U, +0x38142000U, +0x38144000U, +0x38146000U, +0x38148000U, +0x3814A000U, +0x3814C000U, +0x3814E000U, +0x38150000U, +0x38152000U, +0x38154000U, +0x38156000U, +0x38158000U, +0x3815A000U, +0x3815C000U, +0x3815E000U, +0x38160000U, +0x38162000U, +0x38164000U, +0x38166000U, +0x38168000U, +0x3816A000U, +0x3816C000U, +0x3816E000U, +0x38170000U, +0x38172000U, +0x38174000U, +0x38176000U, +0x38178000U, +0x3817A000U, +0x3817C000U, +0x3817E000U, +0x38180000U, +0x38182000U, +0x38184000U, +0x38186000U, +0x38188000U, +0x3818A000U, +0x3818C000U, +0x3818E000U, +0x38190000U, +0x38192000U, +0x38194000U, +0x38196000U, +0x38198000U, +0x3819A000U, +0x3819C000U, +0x3819E000U, +0x381A0000U, +0x381A2000U, +0x381A4000U, +0x381A6000U, +0x381A8000U, +0x381AA000U, +0x381AC000U, +0x381AE000U, +0x381B0000U, +0x381B2000U, +0x381B4000U, +0x381B6000U, +0x381B8000U, +0x381BA000U, +0x381BC000U, +0x381BE000U, +0x381C0000U, +0x381C2000U, +0x381C4000U, +0x381C6000U, +0x381C8000U, +0x381CA000U, +0x381CC000U, +0x381CE000U, +0x381D0000U, +0x381D2000U, +0x381D4000U, +0x381D6000U, +0x381D8000U, +0x381DA000U, +0x381DC000U, +0x381DE000U, +0x381E0000U, +0x381E2000U, +0x381E4000U, +0x381E6000U, +0x381E8000U, +0x381EA000U, +0x381EC000U, +0x381EE000U, +0x381F0000U, +0x381F2000U, +0x381F4000U, +0x381F6000U, +0x381F8000U, +0x381FA000U, +0x381FC000U, +0x381FE000U, +0x38200000U, +0x38202000U, +0x38204000U, +0x38206000U, +0x38208000U, +0x3820A000U, +0x3820C000U, +0x3820E000U, +0x38210000U, +0x38212000U, +0x38214000U, +0x38216000U, +0x38218000U, +0x3821A000U, +0x3821C000U, +0x3821E000U, +0x38220000U, +0x38222000U, +0x38224000U, +0x38226000U, +0x38228000U, +0x3822A000U, +0x3822C000U, +0x3822E000U, +0x38230000U, +0x38232000U, +0x38234000U, +0x38236000U, +0x38238000U, +0x3823A000U, +0x3823C000U, +0x3823E000U, +0x38240000U, +0x38242000U, +0x38244000U, +0x38246000U, +0x38248000U, +0x3824A000U, +0x3824C000U, +0x3824E000U, +0x38250000U, +0x38252000U, +0x38254000U, +0x38256000U, +0x38258000U, +0x3825A000U, +0x3825C000U, +0x3825E000U, +0x38260000U, +0x38262000U, +0x38264000U, +0x38266000U, +0x38268000U, +0x3826A000U, +0x3826C000U, +0x3826E000U, +0x38270000U, +0x38272000U, +0x38274000U, +0x38276000U, +0x38278000U, +0x3827A000U, +0x3827C000U, +0x3827E000U, +0x38280000U, +0x38282000U, +0x38284000U, +0x38286000U, +0x38288000U, +0x3828A000U, +0x3828C000U, +0x3828E000U, +0x38290000U, +0x38292000U, +0x38294000U, +0x38296000U, +0x38298000U, +0x3829A000U, +0x3829C000U, +0x3829E000U, +0x382A0000U, +0x382A2000U, +0x382A4000U, +0x382A6000U, +0x382A8000U, +0x382AA000U, +0x382AC000U, +0x382AE000U, +0x382B0000U, +0x382B2000U, +0x382B4000U, +0x382B6000U, +0x382B8000U, +0x382BA000U, +0x382BC000U, +0x382BE000U, +0x382C0000U, +0x382C2000U, +0x382C4000U, +0x382C6000U, +0x382C8000U, +0x382CA000U, +0x382CC000U, +0x382CE000U, +0x382D0000U, +0x382D2000U, +0x382D4000U, +0x382D6000U, +0x382D8000U, +0x382DA000U, +0x382DC000U, +0x382DE000U, +0x382E0000U, +0x382E2000U, +0x382E4000U, +0x382E6000U, +0x382E8000U, +0x382EA000U, +0x382EC000U, +0x382EE000U, +0x382F0000U, +0x382F2000U, +0x382F4000U, +0x382F6000U, +0x382F8000U, +0x382FA000U, +0x382FC000U, +0x382FE000U, +0x38300000U, +0x38302000U, +0x38304000U, +0x38306000U, +0x38308000U, +0x3830A000U, +0x3830C000U, +0x3830E000U, +0x38310000U, +0x38312000U, +0x38314000U, +0x38316000U, +0x38318000U, +0x3831A000U, +0x3831C000U, +0x3831E000U, +0x38320000U, +0x38322000U, +0x38324000U, +0x38326000U, +0x38328000U, +0x3832A000U, +0x3832C000U, +0x3832E000U, +0x38330000U, +0x38332000U, +0x38334000U, +0x38336000U, +0x38338000U, +0x3833A000U, +0x3833C000U, +0x3833E000U, +0x38340000U, +0x38342000U, +0x38344000U, +0x38346000U, +0x38348000U, +0x3834A000U, +0x3834C000U, +0x3834E000U, +0x38350000U, +0x38352000U, +0x38354000U, +0x38356000U, +0x38358000U, +0x3835A000U, +0x3835C000U, +0x3835E000U, +0x38360000U, +0x38362000U, +0x38364000U, +0x38366000U, +0x38368000U, +0x3836A000U, +0x3836C000U, +0x3836E000U, +0x38370000U, +0x38372000U, +0x38374000U, +0x38376000U, +0x38378000U, +0x3837A000U, +0x3837C000U, +0x3837E000U, +0x38380000U, +0x38382000U, +0x38384000U, +0x38386000U, +0x38388000U, +0x3838A000U, +0x3838C000U, +0x3838E000U, +0x38390000U, +0x38392000U, +0x38394000U, +0x38396000U, +0x38398000U, +0x3839A000U, +0x3839C000U, +0x3839E000U, +0x383A0000U, +0x383A2000U, +0x383A4000U, +0x383A6000U, +0x383A8000U, +0x383AA000U, +0x383AC000U, +0x383AE000U, +0x383B0000U, +0x383B2000U, +0x383B4000U, +0x383B6000U, +0x383B8000U, +0x383BA000U, +0x383BC000U, +0x383BE000U, +0x383C0000U, +0x383C2000U, +0x383C4000U, +0x383C6000U, +0x383C8000U, +0x383CA000U, +0x383CC000U, +0x383CE000U, +0x383D0000U, +0x383D2000U, +0x383D4000U, +0x383D6000U, +0x383D8000U, +0x383DA000U, +0x383DC000U, +0x383DE000U, +0x383E0000U, +0x383E2000U, +0x383E4000U, +0x383E6000U, +0x383E8000U, +0x383EA000U, +0x383EC000U, +0x383EE000U, +0x383F0000U, +0x383F2000U, +0x383F4000U, +0x383F6000U, +0x383F8000U, +0x383FA000U, +0x383FC000U, +0x383FE000U, +0x38400000U, +0x38402000U, +0x38404000U, +0x38406000U, +0x38408000U, +0x3840A000U, +0x3840C000U, +0x3840E000U, +0x38410000U, +0x38412000U, +0x38414000U, +0x38416000U, +0x38418000U, +0x3841A000U, +0x3841C000U, +0x3841E000U, +0x38420000U, +0x38422000U, +0x38424000U, +0x38426000U, +0x38428000U, +0x3842A000U, +0x3842C000U, +0x3842E000U, +0x38430000U, +0x38432000U, +0x38434000U, +0x38436000U, +0x38438000U, +0x3843A000U, +0x3843C000U, +0x3843E000U, +0x38440000U, +0x38442000U, +0x38444000U, +0x38446000U, +0x38448000U, +0x3844A000U, +0x3844C000U, +0x3844E000U, +0x38450000U, +0x38452000U, +0x38454000U, +0x38456000U, +0x38458000U, +0x3845A000U, +0x3845C000U, +0x3845E000U, +0x38460000U, +0x38462000U, +0x38464000U, +0x38466000U, +0x38468000U, +0x3846A000U, +0x3846C000U, +0x3846E000U, +0x38470000U, +0x38472000U, +0x38474000U, +0x38476000U, +0x38478000U, +0x3847A000U, +0x3847C000U, +0x3847E000U, +0x38480000U, +0x38482000U, +0x38484000U, +0x38486000U, +0x38488000U, +0x3848A000U, +0x3848C000U, +0x3848E000U, +0x38490000U, +0x38492000U, +0x38494000U, +0x38496000U, +0x38498000U, +0x3849A000U, +0x3849C000U, +0x3849E000U, +0x384A0000U, +0x384A2000U, +0x384A4000U, +0x384A6000U, +0x384A8000U, +0x384AA000U, +0x384AC000U, +0x384AE000U, +0x384B0000U, +0x384B2000U, +0x384B4000U, +0x384B6000U, +0x384B8000U, +0x384BA000U, +0x384BC000U, +0x384BE000U, +0x384C0000U, +0x384C2000U, +0x384C4000U, +0x384C6000U, +0x384C8000U, +0x384CA000U, +0x384CC000U, +0x384CE000U, +0x384D0000U, +0x384D2000U, +0x384D4000U, +0x384D6000U, +0x384D8000U, +0x384DA000U, +0x384DC000U, +0x384DE000U, +0x384E0000U, +0x384E2000U, +0x384E4000U, +0x384E6000U, +0x384E8000U, +0x384EA000U, +0x384EC000U, +0x384EE000U, +0x384F0000U, +0x384F2000U, +0x384F4000U, +0x384F6000U, +0x384F8000U, +0x384FA000U, +0x384FC000U, +0x384FE000U, +0x38500000U, +0x38502000U, +0x38504000U, +0x38506000U, +0x38508000U, +0x3850A000U, +0x3850C000U, +0x3850E000U, +0x38510000U, +0x38512000U, +0x38514000U, +0x38516000U, +0x38518000U, +0x3851A000U, +0x3851C000U, +0x3851E000U, +0x38520000U, +0x38522000U, +0x38524000U, +0x38526000U, +0x38528000U, +0x3852A000U, +0x3852C000U, +0x3852E000U, +0x38530000U, +0x38532000U, +0x38534000U, +0x38536000U, +0x38538000U, +0x3853A000U, +0x3853C000U, +0x3853E000U, +0x38540000U, +0x38542000U, +0x38544000U, +0x38546000U, +0x38548000U, +0x3854A000U, +0x3854C000U, +0x3854E000U, +0x38550000U, +0x38552000U, +0x38554000U, +0x38556000U, +0x38558000U, +0x3855A000U, +0x3855C000U, +0x3855E000U, +0x38560000U, +0x38562000U, +0x38564000U, +0x38566000U, +0x38568000U, +0x3856A000U, +0x3856C000U, +0x3856E000U, +0x38570000U, +0x38572000U, +0x38574000U, +0x38576000U, +0x38578000U, +0x3857A000U, +0x3857C000U, +0x3857E000U, +0x38580000U, +0x38582000U, +0x38584000U, +0x38586000U, +0x38588000U, +0x3858A000U, +0x3858C000U, +0x3858E000U, +0x38590000U, +0x38592000U, +0x38594000U, +0x38596000U, +0x38598000U, +0x3859A000U, +0x3859C000U, +0x3859E000U, +0x385A0000U, +0x385A2000U, +0x385A4000U, +0x385A6000U, +0x385A8000U, +0x385AA000U, +0x385AC000U, +0x385AE000U, +0x385B0000U, +0x385B2000U, +0x385B4000U, +0x385B6000U, +0x385B8000U, +0x385BA000U, +0x385BC000U, +0x385BE000U, +0x385C0000U, +0x385C2000U, +0x385C4000U, +0x385C6000U, +0x385C8000U, +0x385CA000U, +0x385CC000U, +0x385CE000U, +0x385D0000U, +0x385D2000U, +0x385D4000U, +0x385D6000U, +0x385D8000U, +0x385DA000U, +0x385DC000U, +0x385DE000U, +0x385E0000U, +0x385E2000U, +0x385E4000U, +0x385E6000U, +0x385E8000U, +0x385EA000U, +0x385EC000U, +0x385EE000U, +0x385F0000U, +0x385F2000U, +0x385F4000U, +0x385F6000U, +0x385F8000U, +0x385FA000U, +0x385FC000U, +0x385FE000U, +0x38600000U, +0x38602000U, +0x38604000U, +0x38606000U, +0x38608000U, +0x3860A000U, +0x3860C000U, +0x3860E000U, +0x38610000U, +0x38612000U, +0x38614000U, +0x38616000U, +0x38618000U, +0x3861A000U, +0x3861C000U, +0x3861E000U, +0x38620000U, +0x38622000U, +0x38624000U, +0x38626000U, +0x38628000U, +0x3862A000U, +0x3862C000U, +0x3862E000U, +0x38630000U, +0x38632000U, +0x38634000U, +0x38636000U, +0x38638000U, +0x3863A000U, +0x3863C000U, +0x3863E000U, +0x38640000U, +0x38642000U, +0x38644000U, +0x38646000U, +0x38648000U, +0x3864A000U, +0x3864C000U, +0x3864E000U, +0x38650000U, +0x38652000U, +0x38654000U, +0x38656000U, +0x38658000U, +0x3865A000U, +0x3865C000U, +0x3865E000U, +0x38660000U, +0x38662000U, +0x38664000U, +0x38666000U, +0x38668000U, +0x3866A000U, +0x3866C000U, +0x3866E000U, +0x38670000U, +0x38672000U, +0x38674000U, +0x38676000U, +0x38678000U, +0x3867A000U, +0x3867C000U, +0x3867E000U, +0x38680000U, +0x38682000U, +0x38684000U, +0x38686000U, +0x38688000U, +0x3868A000U, +0x3868C000U, +0x3868E000U, +0x38690000U, +0x38692000U, +0x38694000U, +0x38696000U, +0x38698000U, +0x3869A000U, +0x3869C000U, +0x3869E000U, +0x386A0000U, +0x386A2000U, +0x386A4000U, +0x386A6000U, +0x386A8000U, +0x386AA000U, +0x386AC000U, +0x386AE000U, +0x386B0000U, +0x386B2000U, +0x386B4000U, +0x386B6000U, +0x386B8000U, +0x386BA000U, +0x386BC000U, +0x386BE000U, +0x386C0000U, +0x386C2000U, +0x386C4000U, +0x386C6000U, +0x386C8000U, +0x386CA000U, +0x386CC000U, +0x386CE000U, +0x386D0000U, +0x386D2000U, +0x386D4000U, +0x386D6000U, +0x386D8000U, +0x386DA000U, +0x386DC000U, +0x386DE000U, +0x386E0000U, +0x386E2000U, +0x386E4000U, +0x386E6000U, +0x386E8000U, +0x386EA000U, +0x386EC000U, +0x386EE000U, +0x386F0000U, +0x386F2000U, +0x386F4000U, +0x386F6000U, +0x386F8000U, +0x386FA000U, +0x386FC000U, +0x386FE000U, +0x38700000U, +0x38702000U, +0x38704000U, +0x38706000U, +0x38708000U, +0x3870A000U, +0x3870C000U, +0x3870E000U, +0x38710000U, +0x38712000U, +0x38714000U, +0x38716000U, +0x38718000U, +0x3871A000U, +0x3871C000U, +0x3871E000U, +0x38720000U, +0x38722000U, +0x38724000U, +0x38726000U, +0x38728000U, +0x3872A000U, +0x3872C000U, +0x3872E000U, +0x38730000U, +0x38732000U, +0x38734000U, +0x38736000U, +0x38738000U, +0x3873A000U, +0x3873C000U, +0x3873E000U, +0x38740000U, +0x38742000U, +0x38744000U, +0x38746000U, +0x38748000U, +0x3874A000U, +0x3874C000U, +0x3874E000U, +0x38750000U, +0x38752000U, +0x38754000U, +0x38756000U, +0x38758000U, +0x3875A000U, +0x3875C000U, +0x3875E000U, +0x38760000U, +0x38762000U, +0x38764000U, +0x38766000U, +0x38768000U, +0x3876A000U, +0x3876C000U, +0x3876E000U, +0x38770000U, +0x38772000U, +0x38774000U, +0x38776000U, +0x38778000U, +0x3877A000U, +0x3877C000U, +0x3877E000U, +0x38780000U, +0x38782000U, +0x38784000U, +0x38786000U, +0x38788000U, +0x3878A000U, +0x3878C000U, +0x3878E000U, +0x38790000U, +0x38792000U, +0x38794000U, +0x38796000U, +0x38798000U, +0x3879A000U, +0x3879C000U, +0x3879E000U, +0x387A0000U, +0x387A2000U, +0x387A4000U, +0x387A6000U, +0x387A8000U, +0x387AA000U, +0x387AC000U, +0x387AE000U, +0x387B0000U, +0x387B2000U, +0x387B4000U, +0x387B6000U, +0x387B8000U, +0x387BA000U, +0x387BC000U, +0x387BE000U, +0x387C0000U, +0x387C2000U, +0x387C4000U, +0x387C6000U, +0x387C8000U, +0x387CA000U, +0x387CC000U, +0x387CE000U, +0x387D0000U, +0x387D2000U, +0x387D4000U, +0x387D6000U, +0x387D8000U, +0x387DA000U, +0x387DC000U, +0x387DE000U, +0x387E0000U, +0x387E2000U, +0x387E4000U, +0x387E6000U, +0x387E8000U, +0x387EA000U, +0x387EC000U, +0x387EE000U, +0x387F0000U, +0x387F2000U, +0x387F4000U, +0x387F6000U, +0x387F8000U, +0x387FA000U, +0x387FC000U, +0x387FE000U, +}; + +const quint32 qfloat16::exponenttable[64] = { +0, +0x800000U, +0x1000000U, +0x1800000U, +0x2000000U, +0x2800000U, +0x3000000U, +0x3800000U, +0x4000000U, +0x4800000U, +0x5000000U, +0x5800000U, +0x6000000U, +0x6800000U, +0x7000000U, +0x7800000U, +0x8000000U, +0x8800000U, +0x9000000U, +0x9800000U, +0xA000000U, +0xA800000U, +0xB000000U, +0xB800000U, +0xC000000U, +0xC800000U, +0xD000000U, +0xD800000U, +0xE000000U, +0xE800000U, +0xF000000U, +0x47800000U, +0x80000000U, +0x80800000U, +0x81000000U, +0x81800000U, +0x82000000U, +0x82800000U, +0x83000000U, +0x83800000U, +0x84000000U, +0x84800000U, +0x85000000U, +0x85800000U, +0x86000000U, +0x86800000U, +0x87000000U, +0x87800000U, +0x88000000U, +0x88800000U, +0x89000000U, +0x89800000U, +0x8A000000U, +0x8A800000U, +0x8B000000U, +0x8B800000U, +0x8C000000U, +0x8C800000U, +0x8D000000U, +0x8D800000U, +0x8E000000U, +0x8E800000U, +0x8F000000U, +0xC7800000U, +}; + +const quint32 qfloat16::offsettable[64] = { +0, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +0, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +1024U, +}; + +const quint32 qfloat16::basetable[512] = { +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x0U, +0x1U, +0x2U, +0x4U, +0x8U, +0x10U, +0x20U, +0x40U, +0x80U, +0x100U, +0x200U, +0x400U, +0x800U, +0xC00U, +0x1000U, +0x1400U, +0x1800U, +0x1C00U, +0x2000U, +0x2400U, +0x2800U, +0x2C00U, +0x3000U, +0x3400U, +0x3800U, +0x3C00U, +0x4000U, +0x4400U, +0x4800U, +0x4C00U, +0x5000U, +0x5400U, +0x5800U, +0x5C00U, +0x6000U, +0x6400U, +0x6800U, +0x6C00U, +0x7000U, +0x7400U, +0x7800U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x7C00U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8000U, +0x8001U, +0x8002U, +0x8004U, +0x8008U, +0x8010U, +0x8020U, +0x8040U, +0x8080U, +0x8100U, +0x8200U, +0x8400U, +0x8800U, +0x8C00U, +0x9000U, +0x9400U, +0x9800U, +0x9C00U, +0xA000U, +0xA400U, +0xA800U, +0xAC00U, +0xB000U, +0xB400U, +0xB800U, +0xBC00U, +0xC000U, +0xC400U, +0xC800U, +0xCC00U, +0xD000U, +0xD400U, +0xD800U, +0xDC00U, +0xE000U, +0xE400U, +0xE800U, +0xEC00U, +0xF000U, +0xF400U, +0xF800U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +0xFC00U, +}; + +const quint32 qfloat16::shifttable[512] = { +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x17U, +0x16U, +0x15U, +0x14U, +0x13U, +0x12U, +0x11U, +0x10U, +0xFU, +0xEU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0xDU, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x17U, +0x16U, +0x15U, +0x14U, +0x13U, +0x12U, +0x11U, +0x10U, +0xFU, +0xEU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0xDU, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0x18U, +0xDU, +}; + +#endif // !__F16C__ && !__ARM_FP16_FORMAT_IEEE + +QT_END_NAMESPACE diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c0db2c3db6..a8ed8ca6fd 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1147,12 +1147,12 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value)); \sa QT_VERSION_STR, QLibraryInfo::version() */ -const char *qVersion() Q_DECL_NOTHROW +const char *qVersion() noexcept { return QT_VERSION_STR; } -bool qSharedBuild() Q_DECL_NOTHROW +bool qSharedBuild() noexcept { #ifdef QT_SHARED return true; @@ -1898,6 +1898,42 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! + \macro Q_PROCESSOR_RISCV + \relates <QtGlobal> + \since 5.13 + + Defined if the application is compiled for RISC-V processors. Qt currently + supports two RISC-V variants: \l Q_PROCESSOR_RISCV_32 and \l + Q_PROCESSOR_RISCV_64. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_RISCV_32 + \relates <QtGlobal> + \since 5.13 + + Defined if the application is compiled for 32-bit RISC-V processors. The \l + Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_32 is + defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! + \macro Q_PROCESSOR_RISCV_64 + \relates <QtGlobal> + \since 5.13 + + Defined if the application is compiled for 64-bit RISC-V processors. The \l + Q_PROCESSOR_RISCV macro is also defined when Q_PROCESSOR_RISCV_64 is + defined. + + \sa QSysInfo::buildCpuArchitecture() +*/ + +/*! \macro Q_PROCESSOR_S390 \relates <QtGlobal> @@ -2916,6 +2952,7 @@ QString QSysInfo::machineHostName() struct utsname u; if (uname(&u) == 0) return QString::fromLocal8Bit(u.nodename); + return QString(); #else # ifdef Q_OS_WIN // Important: QtNetwork depends on machineHostName() initializing ws2_32.dll @@ -2928,7 +2965,6 @@ QString QSysInfo::machineHostName() hostName[sizeof(hostName) - 1] = '\0'; return QString::fromLocal8Bit(hostName); #endif - return QString(); } #endif // QT_BOOTSTRAPPED @@ -3220,7 +3256,7 @@ QByteArray QSysInfo::bootUniqueId() The Q_CHECK_PTR macro calls this function if an allocation check fails. */ -void qt_check_pointer(const char *n, int l) Q_DECL_NOTHROW +void qt_check_pointer(const char *n, int l) noexcept { // make separate printing calls so that the first one may flush; // the second one could want to allocate memory (fputs prints a @@ -3247,7 +3283,7 @@ void qBadAlloc() Allows you to call std::terminate() without including <exception>. Called internally from QT_TERMINATE_ON_EXCEPTION */ -Q_NORETURN void qTerminate() Q_DECL_NOTHROW +Q_NORETURN void qTerminate() noexcept { std::terminate(); } @@ -3256,7 +3292,7 @@ Q_NORETURN void qTerminate() Q_DECL_NOTHROW /* The Q_ASSERT macro calls this function when the test fails. */ -void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW +void qt_assert(const char *assertion, const char *file, int line) noexcept { QMessageLogger(file, line, nullptr).fatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line); } @@ -3264,7 +3300,7 @@ void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW /* The Q_ASSERT_X macro calls this function when the test fails. */ -void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW +void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept { QMessageLogger(file, line, nullptr).fatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line); } @@ -3471,7 +3507,7 @@ QString qEnvironmentVariable(const char *varName) \sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet() */ -bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT +bool qEnvironmentVariableIsEmpty(const char *varName) noexcept { QMutexLocker locker(&environmentMutex); #ifdef Q_CC_MSVC @@ -3506,7 +3542,7 @@ bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT \sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsSet() */ -int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT +int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept { static const int NumBinaryDigitsPerOctalDigit = 3; static const int MaxDigitsForOctalInt = @@ -3575,7 +3611,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT \sa qgetenv(), qEnvironmentVariable(), qEnvironmentVariableIsEmpty() */ -bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT +bool qEnvironmentVariableIsSet(const char *varName) noexcept { QMutexLocker locker(&environmentMutex); #ifdef Q_CC_MSVC @@ -3583,7 +3619,7 @@ bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT (void)getenv_s(&requiredSize, 0, 0, varName); return requiredSize != 0; #else - return ::getenv(varName) != 0; + return ::getenv(varName) != nullptr; #endif } @@ -3777,6 +3813,56 @@ bool qunsetenv(const char *varName) */ /*! + \fn template <typename T, typename U = T> T qExchange(T &obj, U &&newValue) + \relates <QtGlobal> + \since 5.14 + + Replaces the value of \a obj with \a newValue and returns the old value of \a obj. + + This is Qt's implementation of std::exchange(). It differs from std::exchange() + only in that it is \c constexpr already in C++14, and available on all supported + compilers. + + Here is how to use qExchange() to implement move constructors: + \code + MyClass(MyClass &&other) + : m_pointer{qExchange(other.m_pointer, nullptr)}, + m_int{qExchange(other.m_int, 0)}, + m_vector{std::move(other.m_vector)}, + ... + \endcode + + For members of class type, we can use std::move(), as their move-constructor will + do the right thing. But for scalar types such as raw pointers or integer type, move + is the same as copy, which, particularly for pointers, is not what we expect. So, we + cannot use std::move() for such types, but we can use std::exchange()/qExchange() to + make sure the source object's member is already reset by the time we get to the + initialization of our next data member, which might come in handy if the constructor + exits with an exception. + + Here is how to use qExchange() to write a loop that consumes the collection it + iterates over: + \code + for (auto &e : qExchange(collection, {}) + doSomethingWith(e); + \endcode + + Which is equivalent to the following, much more verbose code: + \code + { + auto tmp = std::move(collection); + collection = {}; // or collection.clear() + for (auto &e : tmp) + doSomethingWith(e); + } // destroys 'tmp' + \endcode + + This is perfectly safe, as the for-loop keeps the result of qExchange() alive for as + long as the loop runs, saving the declaration of a temporary variable. Be aware, though, + that qExchange() returns a non-const object, so Qt containers may detach. +*/ + +/*! \macro QT_TR_NOOP(sourceText) \relates <QtGlobal> diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 223ebbcabe..15f4621cc0 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -307,6 +307,14 @@ typedef double qreal; # define QT_DEPRECATED_CONSTRUCTOR #endif +#ifndef QT_DEPRECATED_WARNINGS_SINCE +# ifdef QT_DISABLE_DEPRECATED_BEFORE +# define QT_DEPRECATED_WARNINGS_SINCE QT_DISABLE_DEPRECATED_BEFORE +# else +# define QT_DEPRECATED_WARNINGS_SINCE QT_VERSION +# endif +#endif + #ifndef QT_DISABLE_DEPRECATED_BEFORE #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0) #endif @@ -330,6 +338,51 @@ typedef double qreal; #endif /* + QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text) + outputs a deprecation warning if QT_DEPRECATED_WARNINGS_SINCE is equal or greater + than the version specified as major, minor. This makes it possible to deprecate a + function without annoying a user who needs to stick at a specified minimum version + and therefore can't use the new function. +*/ +#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 12, 0) +# define QT_DEPRECATED_VERSION_X_5_12(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_12 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_12(text) +# define QT_DEPRECATED_VERSION_5_12 +#endif + +#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 13, 0) +# define QT_DEPRECATED_VERSION_X_5_13(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_13 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_13(text) +# define QT_DEPRECATED_VERSION_5_13 +#endif + +#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 14, 0) +# define QT_DEPRECATED_VERSION_X_5_14(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_14 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_14(text) +# define QT_DEPRECATED_VERSION_5_14 +#endif + +#if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 15, 0) +# define QT_DEPRECATED_VERSION_X_5_15(text) QT_DEPRECATED_X(text) +# define QT_DEPRECATED_VERSION_5_15 QT_DEPRECATED +#else +# define QT_DEPRECATED_VERSION_X_5_15(text) +# define QT_DEPRECATED_VERSION_5_15 +#endif + +#define QT_DEPRECATED_VERSION_X_5(minor, text) QT_DEPRECATED_VERSION_X_5_##minor(text) +#define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major(minor, text) + +#define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor +#define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major(minor) + +/* The Qt modules' export macros. The options are: - defined(QT_STATIC): Qt was built or is being built in static mode @@ -369,8 +422,8 @@ typedef double qreal; operator to disable copying (the compiler gives an error message). */ #define Q_DISABLE_COPY(Class) \ - Class(const Class &) Q_DECL_EQ_DELETE;\ - Class &operator=(const Class &) Q_DECL_EQ_DELETE; + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; #define Q_DISABLE_MOVE(Class) \ Class(Class &&) = delete; \ @@ -411,7 +464,7 @@ typedef double qreal; #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) extern "C" #endif -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION const char *qVersion(void) Q_DECL_NOEXCEPT; #if defined(__cplusplus) @@ -456,11 +509,8 @@ namespace QtPrivate { template <class T> struct AlignOf : AlignOf_Default<T> { }; template <class T> struct AlignOf<T &> : AlignOf<T> {}; - template <size_t N, class T> struct AlignOf<T[N]> : AlignOf<T> {}; - -#ifdef Q_COMPILER_RVALUE_REFS template <class T> struct AlignOf<T &&> : AlignOf<T> {}; -#endif + template <size_t N, class T> struct AlignOf<T[N]> : AlignOf<T> {}; #if defined(Q_PROCESSOR_X86_32) && !defined(Q_OS_WIN) template <class T> struct AlignOf_WorkaroundForI386Abi { enum { Value = sizeof(T) }; }; @@ -730,7 +780,7 @@ inline void qt_noop(void) {} # define QT_CATCH(A) catch (A) # define QT_THROW(A) throw A # define QT_RETHROW throw -Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; +Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() noexcept; # ifdef Q_COMPILER_NOEXCEPT # define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false) # else @@ -738,7 +788,7 @@ Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW; # endif #endif -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() noexcept; #ifndef Q_OUTOFLINE_TEMPLATE # define Q_OUTOFLINE_TEMPLATE @@ -781,7 +831,7 @@ Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); Q_NORETURN #endif Q_DECL_COLD_FUNCTION -Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW; +Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) noexcept; #if !defined(Q_ASSERT) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) @@ -799,7 +849,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_NORETURN #endif Q_DECL_COLD_FUNCTION -Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW; +Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) noexcept; #if !defined(Q_ASSERT_X) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) @@ -809,7 +859,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char * # endif #endif -Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW; +Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) noexcept; Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qBadAlloc(); @@ -852,38 +902,23 @@ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qFuzzyIsNul return qAbs(f) <= 0.00001f; } -/* - This function tests a double for a null value. It doesn't - check whether the actual value is 0 or close to 0, but whether - it is binary 0, disregarding sign. -*/ -Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(double d) +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wfloat-equal") +QT_WARNING_DISABLE_GCC("-Wfloat-equal") +QT_WARNING_DISABLE_INTEL(1572) + +Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(double d) noexcept { - union U { - double d; - quint64 u; - }; - U val; - val.d = d; - return (val.u & Q_UINT64_C(0x7fffffffffffffff)) == 0; + return d == 0.0; } -/* - This function tests a float for a null value. It doesn't - check whether the actual value is 0 or close to 0, but whether - it is binary 0, disregarding sign. -*/ -Q_REQUIRED_RESULT static inline Q_DECL_UNUSED bool qIsNull(float f) +Q_REQUIRED_RESULT Q_DECL_CONSTEXPR static inline Q_DECL_UNUSED bool qIsNull(float f) noexcept { - union U { - float f; - quint32 u; - }; - U val; - val.f = f; - return (val.u & 0x7fffffff) == 0; + return f == 0.0f; } +QT_WARNING_POP + /* Compilers which follow outdated template instantiation rules require a class to have a comparison operator to exist when @@ -910,14 +945,14 @@ namespace SwapExceptionTester { // insulate users from the "using std::swap" bel using std::swap; // import std::swap template <typename T> void checkSwap(T &t) - Q_DECL_NOEXCEPT_EXPR(noexcept(swap(t, t))); + noexcept(noexcept(swap(t, t))); // declared, but not implemented (only to be used in unevaluated contexts (noexcept operator)) } } // namespace QtPrivate template <typename T> inline void qSwap(T &value1, T &value2) - Q_DECL_NOEXCEPT_EXPR(noexcept(QtPrivate::SwapExceptionTester::checkSwap(value1))) + noexcept(noexcept(QtPrivate::SwapExceptionTester::checkSwap(value1))) { using std::swap; swap(value1, value2); @@ -968,10 +1003,19 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic // this adds const to non-const objects (like std::as_const) template <typename T> -Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } +Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; } // prevent rvalue arguments: template <typename T> -void qAsConst(const T &&) Q_DECL_EQ_DELETE; +void qAsConst(const T &&) = delete; + +// like std::exchange +template <typename T, typename U = T> +Q_DECL_RELAXED_CONSTEXPR T qExchange(T &t, U &&newValue) +{ + T old = std::move(t); + t = std::forward<U>(newValue); + return old; +} #ifndef QT_NO_FOREACH @@ -1052,7 +1096,7 @@ for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \ #endif template <typename T> inline T *qGetPtrHelper(T *ptr) { return ptr; } -template <typename Ptr> inline auto qGetPtrHelper(const Ptr &ptr) -> decltype(ptr.operator->()) { return ptr.operator->(); } +template <typename Ptr> inline auto qGetPtrHelper(Ptr &ptr) -> decltype(ptr.operator->()) { return ptr.operator->(); } // The body must be a statement: #define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP @@ -1130,11 +1174,11 @@ template <typename... Args> struct QNonConstOverload { template <typename R, typename T> - Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) + Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr) { return ptr; } template <typename R, typename T> - static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) + static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr) { return ptr; } }; @@ -1142,11 +1186,11 @@ template <typename... Args> struct QConstOverload { template <typename R, typename T> - Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr) + Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr) { return ptr; } template <typename R, typename T> - static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) Q_DECL_NOTHROW -> decltype(ptr) + static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr) { return ptr; } }; @@ -1159,11 +1203,11 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...> using QNonConstOverload<Args...>::operator(); template <typename R> - Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) + Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr) { return ptr; } template <typename R> - static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) + static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr) { return ptr; } }; @@ -1184,9 +1228,9 @@ Q_CORE_EXPORT QString qEnvironmentVariable(const char *varName, const QString &d Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value); Q_CORE_EXPORT bool qunsetenv(const char *varName); -Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT; -Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT; -Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT; +Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept; +Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept; +Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept; inline int qIntCast(double f) { return int(f); } inline int qIntCast(float f) { return int(f); } diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 555bdf04c1..7a7d65ed76 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -79,16 +79,16 @@ enum GuardValues { Q_GLOBAL_STATIC_INTERNAL_DECORATION Type *innerFunction() \ { \ struct HolderBase { \ - ~HolderBase() Q_DECL_NOTHROW \ - { if (guard.load() == QtGlobalStatic::Initialized) \ - guard.store(QtGlobalStatic::Destroyed); } \ + ~HolderBase() noexcept \ + { if (guard.loadRelaxed() == QtGlobalStatic::Initialized) \ + guard.storeRelaxed(QtGlobalStatic::Destroyed); } \ }; \ static struct Holder : public HolderBase { \ Type value; \ Holder() \ - Q_DECL_NOEXCEPT_EXPR(noexcept(Type ARGS)) \ + noexcept(noexcept(Type ARGS)) \ : value ARGS \ - { guard.store(QtGlobalStatic::Initialized); } \ + { guard.storeRelaxed(QtGlobalStatic::Initialized); } \ } holder; \ return &holder.value; \ } @@ -108,12 +108,12 @@ QT_BEGIN_NAMESPACE int x = guard.loadAcquire(); \ if (Q_UNLIKELY(x >= QtGlobalStatic::Uninitialized)) { \ QMutexLocker locker(&mutex); \ - if (guard.load() == QtGlobalStatic::Uninitialized) { \ + if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { \ d = new Type ARGS; \ static struct Cleanup { \ ~Cleanup() { \ delete d; \ - guard.store(QtGlobalStatic::Destroyed); \ + guard.storeRelaxed(QtGlobalStatic::Destroyed); \ } \ } cleanup; \ guard.storeRelease(QtGlobalStatic::Initialized); \ @@ -129,10 +129,10 @@ struct QGlobalStatic { typedef T Type; - bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; } - bool exists() const { return guard.load() == QtGlobalStatic::Initialized; } - operator Type *() { if (isDestroyed()) return 0; return innerFunction(); } - Type *operator()() { if (isDestroyed()) return 0; return innerFunction(); } + bool isDestroyed() const { return guard.loadRelaxed() <= QtGlobalStatic::Destroyed; } + bool exists() const { return guard.loadRelaxed() == QtGlobalStatic::Initialized; } + operator Type *() { if (isDestroyed()) return nullptr; return innerFunction(); } + Type *operator()() { if (isDestroyed()) return nullptr; return innerFunction(); } Type *operator->() { Q_ASSERT_X(!isDestroyed(), "Q_GLOBAL_STATIC", "The global static was used after being destroyed"); diff --git a/src/corelib/global/qhooks.cpp b/src/corelib/global/qhooks.cpp index bbddb1cbf1..020dee3710 100644 --- a/src/corelib/global/qhooks.cpp +++ b/src/corelib/global/qhooks.cpp @@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = { // The required sizes and offsets are tested in tests/auto/other/toolsupport. // When this fails and the change was intentional, adjust the test and // adjust this value here. - 16 + 17 }; Q_STATIC_ASSERT(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0])); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index d19e54154e..e82939dcd9 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -350,7 +350,7 @@ QLibraryInfo::buildDate() \since 5.3 */ -const char *QLibraryInfo::build() Q_DECL_NOTHROW +const char *QLibraryInfo::build() noexcept { return QT_BUILD_STR; } @@ -377,7 +377,7 @@ QLibraryInfo::isDebugBuild() \sa qVersion() */ -QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW +QVersionNumber QLibraryInfo::version() noexcept { return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH); } @@ -726,11 +726,6 @@ void qt_core_boilerplate() QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); -#ifdef QT_EVAL - extern void qt_core_eval_init(QCoreApplicationPrivate::Type); - qt_core_eval_init(QCoreApplicationPrivate::Tty); -#endif - exit(0); } diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 9414af9b7d..ed60b170a5 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -62,12 +62,12 @@ public: #endif // QT_DEPRECATED_SINCE(5, 5) #endif // datestring - static const char * build() Q_DECL_NOTHROW; + static const char * build() noexcept; static bool isDebugBuild(); #ifndef QT_BOOTSTRAPPED - static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION; #endif enum LibraryLocation diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index ece97077c1..621b6d7d13 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -44,6 +44,7 @@ #include "qlogging_p.h" #include "qlist.h" #include "qbytearray.h" +#include "qscopeguard.h" #include "qstring.h" #include "qvarlengtharray.h" #include "qdebug.h" @@ -158,6 +159,9 @@ static QT_PREPEND_NAMESPACE(qint64) qt_gettid() #endif // !QT_BOOTSTRAPPED #include <cstdlib> +#include <algorithm> +#include <memory> +#include <vector> #include <stdio.h> @@ -194,7 +198,7 @@ static bool isFatal(QtMsgType msgType) // it's fatal if the current value is exactly 1, // otherwise decrement if it's non-zero - return fatalCriticals.load() && fatalCriticals.fetchAndAddRelaxed(-1) == 1; + return fatalCriticals.loadRelaxed() && fatalCriticals.fetchAndAddRelaxed(-1) == 1; } if (msgType == QtWarningMsg || msgType == QtCriticalMsg) { @@ -202,7 +206,7 @@ static bool isFatal(QtMsgType msgType) // it's fatal if the current value is exactly 1, // otherwise decrement if it's non-zero - return fatalWarnings.load() && fatalWarnings.fetchAndAddRelaxed(-1) == 1; + return fatalWarnings.loadRelaxed() && fatalWarnings.fetchAndAddRelaxed(-1) == 1; } return false; @@ -347,7 +351,7 @@ using namespace QtPrivate; */ #if defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR) -static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) Q_DECL_NOEXCEPT +static inline void convert_to_wchar_t_elided(wchar_t *d, size_t space, const char *s) noexcept { size_t len = qstrlen(s); if (len + 1 > space) { @@ -439,7 +443,7 @@ void QMessageLogger::debug(const QLoggingCategory &cat, const char *msg, ...) co return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -466,7 +470,7 @@ void QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc, return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -489,7 +493,7 @@ QDebug QMessageLogger::debug() const { QDebug dbg = QDebug(QtDebugMsg); QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); return dbg; } @@ -506,7 +510,7 @@ QDebug QMessageLogger::debug(const QLoggingCategory &cat) const dbg.stream->message_output = false; QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); return dbg; @@ -530,7 +534,7 @@ QDebug QMessageLogger::debug(QMessageLogger::CategoryFunction catFunc) const \sa QNoDebug, qDebug() */ -QNoDebug QMessageLogger::noDebug() const Q_DECL_NOTHROW +QNoDebug QMessageLogger::noDebug() const noexcept { return QNoDebug(); } @@ -550,7 +554,7 @@ void QMessageLogger::info(const QLoggingCategory &cat, const char *msg, ...) con return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -577,7 +581,7 @@ void QMessageLogger::info(QMessageLogger::CategoryFunction catFunc, return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -601,7 +605,7 @@ QDebug QMessageLogger::info() const { QDebug dbg = QDebug(QtInfoMsg); QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); return dbg; } @@ -618,7 +622,7 @@ QDebug QMessageLogger::info(const QLoggingCategory &cat) const dbg.stream->message_output = false; QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); return dbg; @@ -668,7 +672,7 @@ void QMessageLogger::warning(const QLoggingCategory &cat, const char *msg, ...) return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -695,7 +699,7 @@ void QMessageLogger::warning(QMessageLogger::CategoryFunction catFunc, return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -717,7 +721,7 @@ QDebug QMessageLogger::warning() const { QDebug dbg = QDebug(QtWarningMsg); QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); return dbg; } @@ -733,7 +737,7 @@ QDebug QMessageLogger::warning(const QLoggingCategory &cat) const dbg.stream->message_output = false; QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); return dbg; @@ -784,7 +788,7 @@ void QMessageLogger::critical(const QLoggingCategory &cat, const char *msg, ...) return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -811,7 +815,7 @@ void QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc, return; QMessageLogContext ctxt; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); va_list ap; @@ -833,7 +837,7 @@ QDebug QMessageLogger::critical() const { QDebug dbg = QDebug(QtCriticalMsg); QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); return dbg; } @@ -850,7 +854,7 @@ QDebug QMessageLogger::critical(const QLoggingCategory &cat) const dbg.stream->message_output = false; QMessageLogContext &ctxt = dbg.stream->context; - ctxt.copy(context); + ctxt.copyContextFrom(context); ctxt.category = cat.categoryName(); return dbg; @@ -876,7 +880,7 @@ QDebug QMessageLogger::critical(QMessageLogger::CategoryFunction catFunc) const \sa qFatal() */ -void QMessageLogger::fatal(const char *msg, ...) const Q_DECL_NOTHROW +void QMessageLogger::fatal(const char *msg, ...) const noexcept { QString message; @@ -1076,8 +1080,8 @@ struct QMessagePattern { void setPattern(const QString &pattern); // 0 terminated arrays of literal tokens / literal or placeholder tokens - const char **literals; - const char **tokens; + std::unique_ptr<std::unique_ptr<const char[]>[]> literals; + std::unique_ptr<const char*[]> tokens; QList<QString> timeArgs; // timeFormats in sequence of %{time #ifndef QT_BOOTSTRAPPED QElapsedTimer timer; @@ -1100,9 +1104,6 @@ Q_DECLARE_TYPEINFO(QMessagePattern::BacktraceParams, Q_MOVABLE_TYPE); QBasicMutex QMessagePattern::mutex; QMessagePattern::QMessagePattern() - : literals(0) - , tokens(0) - , fromEnvironment(false) { #ifndef QT_BOOTSTRAPPED timer.start(); @@ -1110,6 +1111,7 @@ QMessagePattern::QMessagePattern() const QString envPattern = QString::fromLocal8Bit(qgetenv("QT_MESSAGE_PATTERN")); if (envPattern.isEmpty()) { setPattern(QLatin1String(defaultPattern)); + fromEnvironment = false; } else { setPattern(envPattern); fromEnvironment = true; @@ -1117,23 +1119,10 @@ QMessagePattern::QMessagePattern() } QMessagePattern::~QMessagePattern() -{ - for (int i = 0; literals[i]; ++i) - delete [] literals[i]; - delete [] literals; - literals = 0; - delete [] tokens; - tokens = 0; -} + = default; void QMessagePattern::setPattern(const QString &pattern) { - if (literals) { - for (int i = 0; literals[i]; ++i) - delete [] literals[i]; - delete [] literals; - } - delete [] tokens; timeArgs.clear(); #ifdef QLOGGING_HAVE_BACKTRACE backtraceArgs.clear(); @@ -1171,9 +1160,9 @@ void QMessagePattern::setPattern(const QString &pattern) lexemes.append(lexeme); // tokenizer - QVarLengthArray<const char*> literalsVar; - tokens = new const char*[lexemes.size() + 1]; - tokens[lexemes.size()] = 0; + std::vector<std::unique_ptr<const char[]>> literalsVar; + tokens.reset(new const char*[lexemes.size() + 1]); + tokens[lexemes.size()] = nullptr; bool nestedIfError = false; bool inIf = false; @@ -1267,7 +1256,7 @@ void QMessagePattern::setPattern(const QString &pattern) char *literal = new char[lexeme.size() + 1]; strncpy(literal, lexeme.toLatin1().constData(), lexeme.size()); literal[lexeme.size()] = '\0'; - literalsVar.append(literal); + literalsVar.emplace_back(literal); tokens[i] = literal; } } @@ -1279,9 +1268,8 @@ void QMessagePattern::setPattern(const QString &pattern) if (!error.isEmpty()) qt_message_print(error); - literals = new const char*[literalsVar.size() + 1]; - literals[literalsVar.size()] = 0; - memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*)); + literals.reset(new std::unique_ptr<const char[]>[literalsVar.size() + 1]); + std::move(literalsVar.begin(), literalsVar.end(), &literals[0]); } #if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED) @@ -1406,7 +1394,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con #endif // we do not convert file, function, line literals to local encoding due to overhead - for (int i = 0; pattern->tokens[i] != 0; ++i) { + for (int i = 0; pattern->tokens[i]; ++i) { const char *token = pattern->tokens[i]; if (token == endifTokenC) { skip = false; @@ -1512,9 +1500,9 @@ static void qDefaultMsgHandler(QtMsgType type, const char *buf); static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &buf); // pointer to QtMsgHandler debug handler (without context) -static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMsgHandler); +static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr); // pointer to QtMessageHandler debug handler (with context) -static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler); +static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(nullptr); // ------------------------ Alternate logging sinks ------------------------- @@ -1826,14 +1814,15 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex // prevent recursion in case the message handler generates messages // itself, e.g. by using Qt API if (grabMessageHandler()) { + const auto ungrab = qScopeGuard([]{ ungrabMessageHandler(); }); + auto oldStyle = msgHandler.loadAcquire(); + auto newStye = messageHandler.loadAcquire(); // prefer new message handler over the old one - if (msgHandler.load() == qDefaultMsgHandler - || messageHandler.load() != qDefaultMessageHandler) { - (*messageHandler.load())(msgType, context, message); + if (newStye || !oldStyle) { + (newStye ? newStye : qDefaultMessageHandler)(msgType, context, message); } else { - (*msgHandler.load())(msgType, message.toLocal8Bit().constData()); + (oldStyle ? oldStyle : qDefaultMsgHandler)(msgType, message.toLocal8Bit().constData()); } - ungrabMessageHandler(); } else { fprintf(stderr, "%s\n", message.toLocal8Bit().constData()); } @@ -2084,18 +2073,20 @@ void qErrnoWarning(int code, const char *msg, ...) QtMessageHandler qInstallMessageHandler(QtMessageHandler h) { - if (!h) - h = qDefaultMessageHandler; - //set 'h' and return old message handler - return messageHandler.fetchAndStoreRelaxed(h); + const auto old = messageHandler.fetchAndStoreOrdered(h); + if (old) + return old; + else + return qDefaultMessageHandler; } QtMsgHandler qInstallMsgHandler(QtMsgHandler h) { - if (!h) - h = qDefaultMsgHandler; - //set 'h' and return old message handler - return msgHandler.fetchAndStoreRelaxed(h); + const auto old = msgHandler.fetchAndStoreOrdered(h); + if (old) + return old; + else + return qDefaultMsgHandler; } void qSetMessagePattern(const QString &pattern) @@ -2108,15 +2099,20 @@ void qSetMessagePattern(const QString &pattern) /*! - Copies context information from \a logContext into this QMessageLogContext + Copies context information from \a logContext into this QMessageLogContext. + Returns a reference to this object. + + Note that the version is \b not copied, only the context information. + \internal */ -void QMessageLogContext::copy(const QMessageLogContext &logContext) +QMessageLogContext &QMessageLogContext::copyContextFrom(const QMessageLogContext &logContext) noexcept { this->category = logContext.category; this->file = logContext.file; this->line = logContext.line; this->function = logContext.function; + return *this; } /*! diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index dded09999b..4a528a2973 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -63,20 +63,19 @@ class QMessageLogContext { Q_DISABLE_COPY(QMessageLogContext) public: - Q_DECL_CONSTEXPR QMessageLogContext() - : version(2), line(0), file(nullptr), function(nullptr), category(nullptr) {} - Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) - : version(2), line(lineNumber), file(fileName), function(functionName), category(categoryName) {} + Q_DECL_CONSTEXPR QMessageLogContext() noexcept = default; + Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept + : line(lineNumber), file(fileName), function(functionName), category(categoryName) {} - void copy(const QMessageLogContext &logContext); - - int version; - int line; - const char *file; - const char *function; - const char *category; + int version = 2; + int line = 0; + const char *file = nullptr; + const char *function = nullptr; + const char *category = nullptr; private: + QMessageLogContext ©ContextFrom(const QMessageLogContext &logContext) noexcept; + friend class QMessageLogger; friend class QDebug; }; @@ -121,7 +120,7 @@ public: Q_NORETURN #endif Q_DECL_COLD_FUNCTION - void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); + void fatal(const char *msg, ...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); #ifndef QT_NO_DEBUG_STREAM QDebug debug() const; @@ -137,7 +136,7 @@ public: QDebug critical(const QLoggingCategory &cat) const; QDebug critical(CategoryFunction catFunc) const; - QNoDebug noDebug() const Q_DECL_NOTHROW; + QNoDebug noDebug() const noexcept; #endif // QT_NO_DEBUG_STREAM private: diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index 05676a0da2..b071c1df62 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -74,18 +74,18 @@ void *qRealloc(void *ptr, size_t size) void *qMallocAligned(size_t size, size_t alignment) { - return qReallocAligned(0, size, 0, alignment); + return qReallocAligned(nullptr, size, 0, alignment); } void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) { // fake an aligned allocation - void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0; + void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : nullptr; if (alignment <= sizeof(void*)) { // special, fast case void **newptr = static_cast<void **>(realloc(actualptr, newsize + sizeof(void*))); if (!newptr) - return 0; + return nullptr; if (newptr == actualptr) { // realloc succeeded without reallocating return oldptr; @@ -105,7 +105,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align void *real = realloc(actualptr, newsize + alignment); if (!real) - return 0; + return nullptr; quintptr faked = reinterpret_cast<quintptr>(real) + alignment; faked &= ~(alignment - 1); diff --git a/src/corelib/global/qfloat16_p.h b/src/corelib/global/qmemory_p.h index f3fc96e119..ac791385bd 100644 --- a/src/corelib/global/qfloat16_p.h +++ b/src/corelib/global/qmemory_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2016 by Southwest Research Institute (R) -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -36,9 +36,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -#ifndef QFLOAT16_P_H -#define QFLOAT16_P_H +#ifndef QMEMORY_P_H +#define QMEMORY_P_H // // W A R N I N G @@ -51,45 +50,22 @@ // We mean it. // -#include <QtCore/qfloat16.h> -#include <QtCore/qsysinfo.h> - -QT_BEGIN_NAMESPACE +#include <QtCore/qglobal.h> -static inline bool qt_is_inf(qfloat16 d) Q_DECL_NOTHROW -{ - bool is_inf; - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) - is_inf = (ch[0] & 0x7c) == 0x7c && (ch[0] & 0x02) == 0; - else - is_inf = (ch[1] & 0x7c) == 0x7c && (ch[1] & 0x02) == 0; - return is_inf; -} +#include <memory> +#include <type_traits> +#include <utility> -static inline bool qt_is_nan(qfloat16 d) Q_DECL_NOTHROW -{ - bool is_nan; - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) - is_nan = (ch[0] & 0x7c) == 0x7c && (ch[0] & 0x02) != 0; - else - is_nan = (ch[1] & 0x7c) == 0x7c && (ch[1] & 0x02) != 0; - return is_nan; -} +QT_BEGIN_NAMESPACE -static inline bool qt_is_finite(qfloat16 d) Q_DECL_NOTHROW +// Like std::make_unique, but less ambitious, so keep as private API, for use in Qt itself: +template <typename T, typename... Args> +typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type +qt_make_unique(Args &&...args) { - bool is_finite; - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) - is_finite = (ch[0] & 0x7c) != 0x7c; - else - is_finite = (ch[1] & 0x7c) != 0x7c; - return is_finite; + return std::unique_ptr<T>{new T(std::forward<Args>(args)...)}; } - QT_END_NAMESPACE -#endif // QFLOAT16_P_H +#endif /* QMEMORY_P_H */ diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 6488426e64..f5f7176670 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -50,10 +50,10 @@ QT_BEGIN_NAMESPACE #if !defined(Q_QDOC) && !defined(Q_MOC_RUN) struct QMetaObject; -const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; // defined in qobject.h (which can't be included here) +const QMetaObject *qt_getQtMetaObject() noexcept; // defined in qobject.h (which can't be included here) #define QT_Q_ENUM(ENUM) \ - inline const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return qt_getQtMetaObject(); } \ - inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; } + inline const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return qt_getQtMetaObject(); } \ + inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; } #define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM) #else #define QT_Q_ENUM Q_ENUM @@ -194,6 +194,13 @@ public: DescendingOrder }; + enum SplitBehaviorFlags { + KeepEmptyParts = 0, + SkipEmptyParts = 0x1, + }; + Q_DECLARE_FLAGS(SplitBehavior, SplitBehaviorFlags) + Q_DECLARE_OPERATORS_FOR_FLAGS(SplitBehavior) + enum TileRule { StretchTile, RepeatTile, @@ -351,14 +358,18 @@ public: WA_MouseTracking = 2, WA_ContentsPropagated = 3, // ## deprecated WA_OpaquePaintEvent = 4, - WA_NoBackground = WA_OpaquePaintEvent, // ## deprecated +#if QT_DEPRECATED_SINCE(5, 14) + WA_NoBackground Q_DECL_ENUMERATOR_DEPRECATED = WA_OpaquePaintEvent, +#endif WA_StaticContents = 5, WA_LaidOut = 7, WA_PaintOnScreen = 8, WA_NoSystemBackground = 9, WA_UpdatesDisabled = 10, WA_Mapped = 11, - WA_MacNoClickThrough = 12, // Mac only +#if QT_DEPRECATED_SINCE(5, 14) + WA_MacNoClickThrough Q_DECL_ENUMERATOR_DEPRECATED = 12, +#endif WA_InputMethodEnabled = 14, WA_WState_Visible = 15, WA_WState_Hidden = 16, @@ -376,8 +387,10 @@ public: WA_Moved = 43, WA_PendingUpdate = 44, WA_InvalidSize = 45, - WA_MacBrushedMetal = 46, // Mac only - WA_MacMetalStyle = WA_MacBrushedMetal, // obsolete +#if QT_DEPRECATED_SINCE(5, 14) + WA_MacBrushedMetal Q_DECL_ENUMERATOR_DEPRECATED = 46, + WA_MacMetalStyle Q_DECL_ENUMERATOR_DEPRECATED = 46, +#endif WA_CustomWhatsThis = 47, WA_LayoutOnEntireRect = 48, WA_OutsideWSRange = 49, @@ -434,7 +447,9 @@ public: WA_LayoutUsesWidgetRect = 92, WA_StyledBackground = 93, // internal - WA_MSWindowsUseDirect3D = 94, // Win only +#if QT_DEPRECATED_SINCE(5, 14) + WA_MSWindowsUseDirect3D Q_DECL_ENUMERATOR_DEPRECATED = 94, +#endif WA_CanHostQMdiSubWindowTitleBar = 95, // Internal WA_MacAlwaysShowToolWindow = 96, // Mac only @@ -466,9 +481,9 @@ public: WA_X11NetWmWindowTypeNotification = 114, WA_X11NetWmWindowTypeCombo = 115, WA_X11NetWmWindowTypeDND = 116, - - WA_MacFrameworkScaled = 117, - +#if QT_DEPRECATED_SINCE(5, 14) + WA_MacFrameworkScaled Q_DECL_ENUMERATOR_DEPRECATED = 117, +#endif WA_SetWindowModality = 118, WA_WState_WindowOpacitySet = 119, // internal WA_TranslucentBackground = 120, @@ -495,7 +510,9 @@ public: enum ApplicationAttribute { AA_ImmediateWidgetCreation = 0, - AA_MSWindowsUseDirect3DByDefault = 1, // Win only +#if QT_DEPRECATED_SINCE(5, 14) + AA_MSWindowsUseDirect3DByDefault Q_DECL_ENUMERATOR_DEPRECATED = 1, +#endif AA_DontShowIconsInMenus = 2, AA_NativeWindows = 3, AA_DontCreateNativeWidgetSiblings = 4, @@ -506,7 +523,9 @@ public: AA_DontUseNativeMenuBar = 6, AA_MacDontSwapCtrlAndMeta = 7, AA_Use96Dpi = 8, - AA_X11InitThreads = 10, +#if QT_DEPRECATED_SINCE(5, 14) + AA_X11InitThreads Q_DECL_ENUMERATOR_DEPRECATED = 10, +#endif AA_SynthesizeTouchForUnhandledMouseEvents = 11, AA_SynthesizeMouseForUnhandledTouchEvents = 12, AA_UseHighDpiPixmaps = 13, @@ -527,6 +546,7 @@ public: AA_DontShowShortcutsInContextMenus = 28, AA_CompressTabletEvents = 29, AA_DisableWindowContextHelpButton = 30, // ### Qt 6: remove me + AA_DisableSessionManager = 31, // Add new attributes before this line AA_AttributeCount @@ -1198,7 +1218,8 @@ public: enum TextFormat { PlainText, RichText, - AutoText + AutoText, + MarkdownText }; enum AspectRatioMode { @@ -1379,7 +1400,9 @@ public: enum InputMethodQuery { ImEnabled = 0x1, ImCursorRectangle = 0x2, - ImMicroFocus = 0x2, // deprecated +#if QT_DEPRECATED_SINCE(5, 14) + ImMicroFocus Q_DECL_ENUMERATOR_DEPRECATED = 0x2, +#endif ImFont = 0x4, ImCursorPosition = 0x8, ImSurroundingText = 0x10, @@ -1614,7 +1637,7 @@ public: TitleBarArea // For move }; -#if defined(Q_COMPILER_CLASS_ENUM) && defined(Q_COMPILER_CONSTEXPR) +#if defined(Q_COMPILER_CONSTEXPR) enum class Initialization { Uninitialized }; @@ -1757,6 +1780,7 @@ public: QT_Q_FLAG(Alignment) QT_Q_ENUM(TextFlag) QT_Q_FLAG(Orientations) + QT_Q_FLAG(SplitBehavior) QT_Q_FLAG(DropActions) QT_Q_FLAG(Edges) QT_Q_FLAG(DockWidgetAreas) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 5bba8c5fe5..0ff6be2049 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -286,6 +286,13 @@ This value was added in Qt 5.10. In Qt 6, WindowContextHelpButtonHint will not be set by default. + \value AA_DisableSessionManager Disables the QSessionManager. + By default Qt will connect to a running session manager for a GUI + application on supported platforms, use of a session manager may be + redundant for system services. + This attribute must be set before QGuiApplication is constructed. + This value was added in 5.13 + The following values are deprecated or obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully @@ -2362,6 +2369,19 @@ */ /*! + \enum Qt::SplitBehaviorFlags + \since 5.14 + + This enum specifies how the split() functions should behave with + respect to empty strings. + + \value KeepEmptyParts If a field is empty, keep it in the result. + \value SkipEmptyParts If a field is empty, don't include it in the result. + + \sa QString::split() +*/ + +/*! \enum Qt::ClipOperation \value NoClip This operation turns clipping off. @@ -2464,6 +2484,9 @@ \value AutoText The text string is interpreted as for Qt::RichText if Qt::mightBeRichText() returns \c true, otherwise as Qt::PlainText. + + \value MarkdownText The text string is interpreted as Markdown-formatted text. + This enum value was added in Qt 5.14. */ /*! diff --git a/src/corelib/global/qnumeric.cpp b/src/corelib/global/qnumeric.cpp index fc2b052edf..11440f40a4 100644 --- a/src/corelib/global/qnumeric.cpp +++ b/src/corelib/global/qnumeric.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE /*! Returns \c true if the double \a {d} is equivalent to infinity. \relates <QtGlobal> + \sa qInf() */ Q_CORE_EXPORT bool qIsInf(double d) { return qt_is_inf(d); } @@ -64,6 +65,7 @@ Q_CORE_EXPORT bool qIsFinite(double d) { return qt_is_finite(d); } /*! Returns \c true if the float \a {f} is equivalent to infinity. \relates <QtGlobal> + \sa qInf() */ Q_CORE_EXPORT bool qIsInf(float f) { return qt_is_inf(f); } @@ -88,15 +90,37 @@ Q_CORE_EXPORT double qSNaN() { return qt_snan(); } /*! Returns the bit pattern of a quiet NaN as a double. \relates <QtGlobal> + \sa qIsNaN() */ Q_CORE_EXPORT double qQNaN() { return qt_qnan(); } /*! Returns the bit pattern for an infinite number as a double. \relates <QtGlobal> + \sa qIsInf() */ Q_CORE_EXPORT double qInf() { return qt_inf(); } +/*! + \relates <QtGlobal> + Classifies a floating-point value. + + The return values are defined in \c{<cmath>}: returns one of the following, + determined by the floating-point class of \a val: + \list + \li FP_NAN not a number + \li FP_INFINITE infinities (positive or negative) + \li FP_ZERO zero (positive or negative) + \li FP_NORMAL finite with a full mantissa + \li FP_SUBNORMAL finite with a reduced mantissa + \endlist +*/ +Q_CORE_EXPORT int qFpClassify(double val) { return qt_fpclassify(val); } + +/*! + \overload +*/ +Q_CORE_EXPORT int qFpClassify(float val) { return qt_fpclassify(val); } /*! diff --git a/src/corelib/global/qnumeric.h b/src/corelib/global/qnumeric.h index 535a96aaec..6a0c64712f 100644 --- a/src/corelib/global/qnumeric.h +++ b/src/corelib/global/qnumeric.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -48,9 +48,11 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(double d); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(double d); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(double d); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify(double val); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsInf(float f); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsNaN(float f); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qIsFinite(float f); +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION int qFpClassify(float val); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qSNaN(); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN(); Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf(); diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 4a225b2599..21f9cfbef0 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -85,9 +85,11 @@ namespace qnumeric_std_wrapper { Q_DECL_CONST_FUNCTION static inline bool math_h_isnan(double d) { using namespace std; return isnan(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(double d) { using namespace std; return isinf(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(double d) { using namespace std; return isfinite(d); } +Q_DECL_CONST_FUNCTION static inline int math_h_fpclassify(double d) { using namespace std; return fpclassify(d); } Q_DECL_CONST_FUNCTION static inline bool math_h_isnan(float f) { using namespace std; return isnan(f); } Q_DECL_CONST_FUNCTION static inline bool math_h_isinf(float f) { using namespace std; return isinf(f); } Q_DECL_CONST_FUNCTION static inline bool math_h_isfinite(float f) { using namespace std; return isfinite(f); } +Q_DECL_CONST_FUNCTION static inline int math_h_fpclassify(float f) { using namespace std; return fpclassify(f); } } QT_END_NAMESPACE // These macros from math.h conflict with the real functions in the std namespace. @@ -95,6 +97,7 @@ QT_END_NAMESPACE # undef isnan # undef isinf # undef isfinite +# undef fpclassify # endif // defined(isnan) #endif @@ -106,20 +109,24 @@ namespace qnumeric_std_wrapper { Q_DECL_CONST_FUNCTION static inline bool isnan(double d) { return math_h_isnan(d); } Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return math_h_isinf(d); } Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return math_h_isfinite(d); } +Q_DECL_CONST_FUNCTION static inline int fpclassify(double d) { return math_h_fpclassify(d); } Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return math_h_isnan(f); } Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return math_h_isinf(f); } Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return math_h_isfinite(f); } +Q_DECL_CONST_FUNCTION static inline int fpclassify(float f) { return math_h_fpclassify(f); } #else Q_DECL_CONST_FUNCTION static inline bool isnan(double d) { return std::isnan(d); } Q_DECL_CONST_FUNCTION static inline bool isinf(double d) { return std::isinf(d); } Q_DECL_CONST_FUNCTION static inline bool isfinite(double d) { return std::isfinite(d); } +Q_DECL_CONST_FUNCTION static inline int fpclassify(double d) { return std::fpclassify(d); } Q_DECL_CONST_FUNCTION static inline bool isnan(float f) { return std::isnan(f); } Q_DECL_CONST_FUNCTION static inline bool isinf(float f) { return std::isinf(f); } Q_DECL_CONST_FUNCTION static inline bool isfinite(float f) { return std::isfinite(f); } +Q_DECL_CONST_FUNCTION static inline int fpclassify(float f) { return std::fpclassify(f); } #endif } -Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEXCEPT +Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() noexcept { Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_infinity, "platform has no definition for infinity for type double"); @@ -127,7 +134,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_inf() Q_DECL_NOEX } // Signaling NaN -Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOEXCEPT +Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() noexcept { Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_signaling_NaN, "platform has no definition for signaling NaN for type double"); @@ -135,7 +142,7 @@ Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_snan() Q_DECL_NOE } // Quiet NaN -Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() Q_DECL_NOEXCEPT +Q_DECL_CONSTEXPR Q_DECL_CONST_FUNCTION static inline double qt_qnan() noexcept { Q_STATIC_ASSERT_X(std::numeric_limits<double>::has_quiet_NaN, "platform has no definition for quiet NaN for type double"); @@ -157,6 +164,11 @@ Q_DECL_CONST_FUNCTION static inline bool qt_is_finite(double d) return qnumeric_std_wrapper::isfinite(d); } +Q_DECL_CONST_FUNCTION static inline int qt_fpclassify(double d) +{ + return qnumeric_std_wrapper::fpclassify(d); +} + Q_DECL_CONST_FUNCTION static inline bool qt_is_inf(float f) { return qnumeric_std_wrapper::isinf(f); @@ -172,6 +184,11 @@ Q_DECL_CONST_FUNCTION static inline bool qt_is_finite(float f) return qnumeric_std_wrapper::isfinite(f); } +Q_DECL_CONST_FUNCTION static inline int qt_fpclassify(float f) +{ + return qnumeric_std_wrapper::fpclassify(f); +} + #ifndef Q_CLANG_QDOC namespace { /*! diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 94dc261b41..42a1275621 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -340,7 +340,6 @@ QString QOperatingSystemVersion::name() const } } -#ifdef Q_COMPILER_INITIALIZER_LISTS /*! \fn bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) const @@ -355,7 +354,6 @@ bool QOperatingSystemVersion::isAnyOfType(std::initializer_list<OSType> types) c } return false; } -#endif /*! \variable QOperatingSystemVersion::Windows7 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index df01e5438a..e99e4f8997 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -119,9 +119,7 @@ public: Q_DECL_CONSTEXPR int segmentCount() const { return m_micro >= 0 ? 3 : m_minor >= 0 ? 2 : m_major >= 0 ? 1 : 0; } -#ifdef Q_COMPILER_INITIALIZER_LISTS bool isAnyOfType(std::initializer_list<OSType> types) const; -#endif Q_DECL_CONSTEXPR OSType type() const { return m_os; } QString name() const; diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp index 2da190da48..798d985a76 100644 --- a/src/corelib/global/qoperatingsystemversion_win.cpp +++ b/src/corelib/global/qoperatingsystemversion_win.cpp @@ -84,7 +84,6 @@ static inline OSVERSIONINFOEX determineWinOsVersion() #define pGetModuleHandle GetModuleHandleW #endif -#ifndef Q_OS_WINCE HMODULE ntdll = pGetModuleHandle(L"ntdll.dll"); if (Q_UNLIKELY(!ntdll)) return result; @@ -104,9 +103,6 @@ static inline OSVERSIONINFOEX determineWinOsVersion() // GetVersionEx() has been deprecated in Windows 8.1 and will return // only Windows 8 from that version on, so use the kernel API function. pRtlGetVersion(reinterpret_cast<LPOSVERSIONINFO>(&result)); // always returns STATUS_SUCCESS -#else // !Q_OS_WINCE - GetVersionEx(&result); -#endif return result; } diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 1f327c352e..8d65720850 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -282,6 +282,20 @@ // Q_BYTE_ORDER not defined, use endianness auto-detection /* + RISC-V family, known variants: 32- and 64-bit + + RISC-V is little-endian. +*/ +#elif defined(__riscv) +# define Q_PROCESSOR_RISCV +# if __riscv_xlen == 64 +# define Q_PROCESSOR_RISCV_64 +# else +# define Q_PROCESSOR_RISCV_32 +# endif +# define Q_BYTE_ORDER Q_LITTLE_ENDIAN + +/* S390 family, known variant: S390X (64-bit) S390 is big-endian. diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index bf01b7ae2a..711eb8f4d5 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -91,7 +91,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando QT_BEGIN_NAMESPACE #if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) -static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW; +static qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept; # ifdef Q_PROCESSOR_X86_64 # define _rdrandXX_step _rdrand64_step @@ -99,7 +99,7 @@ static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW; # define _rdrandXX_step _rdrand32_step # endif -static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW +static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) noexcept { unsigned *ptr = reinterpret_cast<unsigned *>(buffer); unsigned *end = ptr + count; @@ -134,7 +134,7 @@ enum { struct QRandomGenerator::SystemGenerator { #if QT_CONFIG(getentropy) - static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW + static qsizetype fillBuffer(void *buffer, qsizetype count) noexcept { // getentropy can read at most 256 bytes, so break the reading qsizetype read = 0; @@ -186,7 +186,7 @@ struct QRandomGenerator::SystemGenerator #endif static void closeDevice() { - int fd = self().fdp1.load() - 1; + int fd = self().fdp1.loadRelaxed() - 1; if (fd >= 0) qt_safe_close(fd); } @@ -204,13 +204,13 @@ struct QRandomGenerator::SystemGenerator } #elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) - qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW + qsizetype fillBuffer(void *buffer, qsizetype count) noexcept { auto RtlGenRandom = SystemFunction036; return RtlGenRandom(buffer, ULONG(count)) ? count: 0; } #elif defined(Q_OS_WINRT) - qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW + qsizetype fillBuffer(void *, qsizetype) noexcept { // always use the fallback return 0; @@ -219,7 +219,7 @@ struct QRandomGenerator::SystemGenerator static SystemGenerator &self(); typedef quint32 result_type; - void generate(quint32 *begin, quint32 *end) Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept); + void generate(quint32 *begin, quint32 *end) noexcept(FillBufferNoexcept); // For std::mersenne_twister_engine implementations that use something // other than quint32 (unsigned int) to fill their buffers. @@ -242,7 +242,7 @@ struct QRandomGenerator::SystemGenerator #if defined(Q_OS_WIN) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) noexcept { // on Windows, rand_s is a high-quality random number generator // and it requires no seeding @@ -254,14 +254,14 @@ static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW } #elif QT_CONFIG(getentropy) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW +static void fallback_fill(quint32 *, qsizetype) noexcept { // no fallback necessary, getentropy cannot fail under normal circumstances Q_UNREACHABLE(); } #elif defined(Q_OS_BSD4) && !defined(__GLIBC__) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) noexcept { // BSDs have arc4random(4) and these work even in chroot(2) arc4random_buf(ptr, left * sizeof(*ptr)); @@ -280,7 +280,7 @@ Q_NEVER_INLINE #ifdef Q_CC_GNU __attribute__((cold)) // this function is pretty big, so optimize for size #endif -static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) noexcept { quint32 scratch[12]; // see element count below quint32 *end = scratch; @@ -310,7 +310,7 @@ static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW *end++ = quint32(nsecs); // 5 #endif - if (quint32 v = seed.load()) + if (quint32 v = seed.loadRelaxed()) *end++ = v; // 6 #if QT_CONFIG(getauxval) @@ -354,22 +354,22 @@ static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW #endif Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin, quint32 *end) - Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept) + noexcept(FillBufferNoexcept) { quint32 *buffer = begin; qsizetype count = end - begin; - if (Q_UNLIKELY(uint(qt_randomdevice_control) & SetRandomData)) { - uint value = uint(qt_randomdevice_control) & RandomDataMask; + if (Q_UNLIKELY(uint(qt_randomdevice_control.loadAcquire()) & SetRandomData)) { + uint value = uint(qt_randomdevice_control.loadAcquire()) & RandomDataMask; std::fill_n(buffer, count, value); return; } qsizetype filled = 0; - if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0) + if (qt_has_hwrng() && (uint(qt_randomdevice_control.loadAcquire()) & SkipHWRNG) == 0) filled += qt_random_cpu(buffer, count); - if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) { + if (filled != count && (uint(qt_randomdevice_control.loadAcquire()) & SkipSystemRNG) == 0) { qsizetype bytesFilled = fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer))); filled += bytesFilled / qsizetype(sizeof(*buffer)); @@ -1175,7 +1175,7 @@ QRandomGenerator &QRandomGenerator::operator=(const QRandomGenerator &other) return *this; } -QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW +QRandomGenerator::QRandomGenerator(std::seed_seq &sseq) noexcept : type(MersenneTwister) { Q_ASSERT(this != system()); @@ -1230,7 +1230,7 @@ void QRandomGenerator::_fillRange(void *buffer, void *bufferEnd) quint32 *begin = static_cast<quint32 *>(buffer); quint32 *end = static_cast<quint32 *>(bufferEnd); - if (type == SystemRNG || Q_UNLIKELY(uint(qt_randomdevice_control) & (UseSystemRNG|SetRandomData))) + if (type == SystemRNG || Q_UNLIKELY(uint(qt_randomdevice_control.loadAcquire()) & (UseSystemRNG|SetRandomData))) return SystemGenerator::self().generate(begin, end); SystemAndGlobalGenerators::PRNGLocker lock(this); diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h index 260fc1501a..445b520c76 100644 --- a/src/corelib/global/qrandom.h +++ b/src/corelib/global/qrandom.h @@ -68,7 +68,7 @@ public: QRandomGenerator(const quint32 *seedBuffer, qsizetype len) : QRandomGenerator(seedBuffer, seedBuffer + len) {} - Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW; + Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) noexcept; Q_CORE_EXPORT QRandomGenerator(const quint32 *begin, const quint32 *end); // copy constructor & assignment operator (move unnecessary) @@ -167,7 +167,7 @@ public: typedef quint32 result_type; result_type operator()() { return generate(); } void seed(quint32 s = 1) { *this = { s }; } - void seed(std::seed_seq &sseq) Q_DECL_NOTHROW { *this = { sseq }; } + void seed(std::seed_seq &sseq) noexcept { *this = { sseq }; } Q_CORE_EXPORT void discard(unsigned long long z); static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits<result_type>::min(); } static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits<result_type>::max(); } @@ -230,7 +230,7 @@ public: QRandomGenerator64(const quint32 *seedBuffer, qsizetype len) : QRandomGenerator(seedBuffer, len) {} - QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW + QRandomGenerator64(std::seed_seq &sseq) noexcept : QRandomGenerator(sseq) {} QRandomGenerator64(const quint32 *begin, const quint32 *end) diff --git a/src/corelib/global/qrandom_p.h b/src/corelib/global/qrandom_p.h index 917a91098e..167f4cc57d 100644 --- a/src/corelib/global/qrandom_p.h +++ b/src/corelib/global/qrandom_p.h @@ -76,7 +76,9 @@ Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control = Q_BASIC_ATOMIC #elif defined(QT_BUILD_INTERNAL) extern Q_CORE_EXPORT QBasicAtomicInteger<uint> qt_randomdevice_control; #else -enum { qt_randomdevice_control = 0 }; +static const struct { + uint loadAcquire() const { return 0; } +} qt_randomdevice_control; #endif inline bool qt_has_hwrng() diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index a2e51fa330..02e2f77c6b 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -166,6 +166,8 @@ # define Q_OS_QNX #elif defined(__INTEGRITY) # define Q_OS_INTEGRITY +#elif defined(__rtems__) +# define Q_OS_RTEMS #elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ # define Q_OS_VXWORKS #elif defined(__HAIKU__) diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h index 4cef126bb6..d9011c6066 100644 --- a/src/corelib/global/qtrace_p.h +++ b/src/corelib/global/qtrace_p.h @@ -122,6 +122,7 @@ QT_BEGIN_NAMESPACE #if defined(Q_TRACEPOINT) && !defined(QT_BOOTSTRAPPED) +# define Q_HAS_TRACEPOINTS 1 # define Q_TRACE(x, ...) QtPrivate::trace_ ## x(__VA_ARGS__) # define Q_TRACE_EXIT(x, ...) \ const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); }); @@ -131,6 +132,7 @@ QT_BEGIN_NAMESPACE # define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__) # define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled() #else +# define Q_HAS_TRACEPOINTS 0 # define Q_TRACE(x, ...) # define Q_TRACE_EXIT(x, ...) # define Q_TRACE_SCOPE(x, ...) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 567ff5c08e..30be47296e 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -213,7 +213,6 @@ Q_DECLARE_MOVABLE_CONTAINER(QList); Q_DECLARE_MOVABLE_CONTAINER(QVector); Q_DECLARE_MOVABLE_CONTAINER(QQueue); Q_DECLARE_MOVABLE_CONTAINER(QStack); -Q_DECLARE_MOVABLE_CONTAINER(QLinkedList); Q_DECLARE_MOVABLE_CONTAINER(QSet); #undef Q_DECLARE_MOVABLE_CONTAINER @@ -308,7 +307,7 @@ Q_DECLARE_TYPEINFO_BODY(QFlags<T>, Q_PRIMITIVE_TYPE); #define Q_DECLARE_SHARED_IMPL(TYPE, FLAGS) \ Q_DECLARE_TYPEINFO(TYPE, FLAGS); \ inline void swap(TYPE &value1, TYPE &value2) \ - Q_DECL_NOEXCEPT_EXPR(noexcept(value1.swap(value2))) \ + noexcept(noexcept(value1.swap(value2))) \ { value1.swap(value2); } #define Q_DECLARE_SHARED(TYPE) Q_DECLARE_SHARED_IMPL(TYPE, Q_MOVABLE_TYPE) #define Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(TYPE) \ |