diff options
Diffstat (limited to 'src/corelib/tools/qalgorithms.h')
-rw-r--r-- | src/corelib/tools/qalgorithms.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 6e68bc7eb1..6e472e8b22 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -516,14 +516,19 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera #endif // QT_DEPRECATED_SINCE(5, 2) +#ifdef Q_CC_CLANG // Clang had a bug where __builtin_ctz/clz/popcount were not marked as constexpr. -#if !defined Q_CC_CLANG || (defined __apple_build_version__ && __clang_major__ >= 7) \ - || (Q_CC_CLANG >= 307) +# if (defined __apple_build_version__ && __clang_major__ >= 7) || (Q_CC_CLANG >= 307) +# define QT_HAS_CONSTEXPR_BUILTINS +# endif +#elif defined(Q_CC_MSVC) && !defined(Q_CC_INTEL) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM) +# define QT_HAS_CONSTEXPR_BUILTINS +#elif defined(Q_CC_GNU) # define QT_HAS_CONSTEXPR_BUILTINS #endif #if defined QT_HAS_CONSTEXPR_BUILTINS -#if defined(Q_CC_GNU) +#if defined(Q_CC_GNU) || defined(Q_CC_CLANG) # define QT_HAS_BUILTIN_CTZS Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW { |