Advertisement
Guest User

fix qt 5.8.0 vc2017 build

a guest
Jan 24th, 2017
991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.09 KB | None | 0 0
  1. --- a\qtbase\src\corelib\tools\qalgorithms.h
  2. +++ b\qtbase\src\corelib\tools\qalgorithms.h
  3. @@ -587,19 +587,20 @@
  4.  Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
  5.  {
  6.      return __builtin_popcountll(v);
  7.  }
  8.  #elif defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM)
  9. +#define QT_POPCOUNT_CONSTEXPR
  10.  #define QT_HAS_BUILTIN_CTZ
  11. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val)
  12. +Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val)
  13.  {
  14.      unsigned long result;
  15.      _BitScanForward(&result, val);
  16.      return result;
  17.  }
  18.  #define QT_HAS_BUILTIN_CLZ
  19. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val)
  20. +Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val)
  21.  {
  22.      unsigned long result;
  23.      _BitScanReverse(&result, val);
  24.      // Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
  25.      // and the lsb index is 0. The result for the index when counting up: msb index is 0 (because it
  26. @@ -608,63 +609,66 @@
  27.      return result;
  28.  }
  29.  #if Q_PROCESSOR_WORDSIZE == 8
  30.  // These are only defined for 64bit builds.
  31.  #define QT_HAS_BUILTIN_CTZLL
  32. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val)
  33. +Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val)
  34.  {
  35.      unsigned long result;
  36.      _BitScanForward64(&result, val);
  37.      return result;
  38.  }
  39.  // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need
  40.  #define QT_HAS_BUILTIN_CLZLL
  41. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
  42. +Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
  43.  {
  44.      unsigned long result;
  45.      _BitScanReverse64(&result, val);
  46.      // see qt_builtin_clz
  47.      result ^= sizeof(quint64) * 8 - 1;
  48.      return result;
  49.  }
  50.  #endif // MSVC 64bit
  51.  #  define QT_HAS_BUILTIN_CTZS
  52. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
  53. +Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
  54.  {
  55.      return qt_builtin_ctz(v);
  56.  }
  57.  #define QT_HAS_BUILTIN_CLZS
  58. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
  59. +Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
  60.  {
  61.      return qt_builtin_clz(v) - 16U;
  62.  }
  63.  #define QALGORITHMS_USE_BUILTIN_POPCOUNT
  64. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
  65. +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
  66.  {
  67.      return __popcnt(v);
  68.  }
  69. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
  70. +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
  71.  {
  72.      return __popcnt16(v);
  73.  }
  74. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
  75. +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
  76.  {
  77.      return __popcnt16(v);
  78.  }
  79.  #if Q_PROCESSOR_WORDSIZE == 8
  80.  #define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
  81. -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
  82. +Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
  83.  {
  84.      return __popcnt64(v);
  85.  }
  86.  #endif // MSVC 64bit
  87.  #endif // MSVC
  88.  #endif // QT_HAS_CONSTEXPR_BUILTINS
  89.  
  90. +#ifndef QT_POPCOUNT_CONSTEXPR
  91. +#define QT_POPCOUNT_CONSTEXPR Q_DECL_CONSTEXPR
  92. +#endif
  93.  } //namespace QAlgorithmsPrivate
  94.  
  95. -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
  96. +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
  97.  {
  98.  #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
  99.      return QAlgorithmsPrivate::qt_builtin_popcount(v);
  100.  #else
  101.      // See http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
  102. @@ -673,32 +677,32 @@
  103.          (((v >> 12) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f +
  104.          (((v >> 24) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f;
  105.  #endif
  106.  }
  107.  
  108. -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
  109. +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
  110.  {
  111.  #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
  112.      return QAlgorithmsPrivate::qt_builtin_popcount(v);
  113.  #else
  114.      return
  115.          (((v      ) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f;
  116.  #endif
  117.  }
  118.  
  119. -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
  120. +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
  121.  {
  122.  #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
  123.      return QAlgorithmsPrivate::qt_builtin_popcount(v);
  124.  #else
  125.      return
  126.          (((v      ) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f +
  127.          (((v >> 12) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f;
  128.  #endif
  129.  }
  130.  
  131. -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
  132. +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
  133.  {
  134.  #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL
  135.      return QAlgorithmsPrivate::qt_builtin_popcountll(v);
  136.  #else
  137.      return
  138. @@ -709,18 +713,19 @@
  139.          (((v >> 48) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f +
  140.          (((v >> 60) & 0xfff)    * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f;
  141.  #endif
  142.  }
  143.  
  144. -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW
  145. +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW
  146.  {
  147.      return qPopulationCount(static_cast<quint64>(v));
  148.  }
  149.  
  150.  #if defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
  151.  #undef QALGORITHMS_USE_BUILTIN_POPCOUNT
  152.  #endif
  153. +#undef QT_POPCOUNT_CONSTEXPR
  154.  
  155.  Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW
  156.  {
  157.  #if defined(QT_HAS_BUILTIN_CTZ)
  158.      return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 32U;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement