From 8bb962fef8314fc8e6bab57d0602033df4354ab7 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 25 Mar 2019 14:58:29 +0000 Subject: [PATCH] Backport Qt constexpr fix. Closes #1319 * This originally comes from a fix for QTBUG-67259, in codereview 224386 - https://codereview.qt-project.org/#/c/224386/ * Cherry-picked back to our Qt from 5.9.7/5.11.2 --- qrenderdoc/3rdparty/qt/include/QtCore/qalgorithms.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qrenderdoc/3rdparty/qt/include/QtCore/qalgorithms.h b/qrenderdoc/3rdparty/qt/include/QtCore/qalgorithms.h index c0f7709fe..3784ceff8 100644 --- a/qrenderdoc/3rdparty/qt/include/QtCore/qalgorithms.h +++ b/qrenderdoc/3rdparty/qt/include/QtCore/qalgorithms.h @@ -590,6 +590,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NO } #elif defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM) #define QT_POPCOUNT_CONSTEXPR +#define QT_POPCOUNT_RELAXED_CONSTEXPR #define QT_HAS_BUILTIN_CTZ Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val) { @@ -676,6 +677,7 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW #ifndef QT_POPCOUNT_CONSTEXPR #define QT_POPCOUNT_CONSTEXPR Q_DECL_CONSTEXPR +#define QT_POPCOUNT_RELAXED_CONSTEXPR Q_DECL_RELAXED_CONSTEXPR #endif } //namespace QAlgorithmsPrivate @@ -819,7 +821,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOT #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTHROW { #if defined(QT_HAS_BUILTIN_CLZ) return v ? QAlgorithmsPrivate::qt_builtin_clz(v)-24U : 8U; @@ -831,7 +833,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTH #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW { #if defined(QT_HAS_BUILTIN_CLZS) return v ? QAlgorithmsPrivate::qt_builtin_clzs(v) : 16U; @@ -844,7 +846,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOT #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOTHROW { #if defined(QT_HAS_BUILTIN_CLZLL) return v ? QAlgorithmsPrivate::qt_builtin_clzll(v) : 64U; @@ -859,7 +861,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOT #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) Q_DECL_NOTHROW { return qCountLeadingZeroBits(QIntegerForSizeof::Unsigned(v)); }