8#pragma qt_class(QtAlgorithms)
11#include <QtCore/qglobal.h>
13#if __has_include(<bit>) && __cplusplus > 201703L
23template <
typename ForwardIterator>
32template <
typename Container>
44#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
46# define QT_HAS_CONSTEXPR_BITOPS
47#elif defined(Q_CC_GNU)
48# define QT_HAS_CONSTEXPR_BITOPS
49# define QT_HAS_BUILTIN_CTZS
52# if __has_builtin(__builtin_ctzs)
53 return __builtin_ctzs(
v);
55 return __builtin_ctz(
v);
58#define QT_HAS_BUILTIN_CLZS
61# if __has_builtin(__builtin_clzs)
62 return __builtin_clzs(
v);
64 return __builtin_clz(
v) - 16U;
67#define QT_HAS_BUILTIN_CTZ
70 return __builtin_ctz(
v);
72#define QT_HAS_BUILTIN_CLZ
75 return __builtin_clz(
v);
77#define QT_HAS_BUILTIN_CTZLL
80 return __builtin_ctzll(
v);
82#define QT_HAS_BUILTIN_CLZLL
85 return __builtin_clzll(
v);
87#define QALGORITHMS_USE_BUILTIN_POPCOUNT
90 return __builtin_popcount(
v);
94 return __builtin_popcount(
v);
98 return __builtin_popcount(
v);
100#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
103 return __builtin_popcountll(
v);
105#elif defined(Q_CC_MSVC) && !defined(Q_PROCESSOR_ARM)
106#define QT_HAS_BUILTIN_CTZ
113#define QT_HAS_BUILTIN_CLZ
124#if Q_PROCESSOR_WORDSIZE == 8
126#define QT_HAS_BUILTIN_CTZLL
134#define QT_HAS_BUILTIN_CLZLL
144# define QT_HAS_BUILTIN_CTZS
147 return qt_builtin_ctz(
v);
149#define QT_HAS_BUILTIN_CLZS
152 return qt_builtin_clz(
v) - 16U;
164#if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__)
165#define QT_POPCOUNT_CONSTEXPR
166#define QT_POPCOUNT_RELAXED_CONSTEXPR
167#define QALGORITHMS_USE_BUILTIN_POPCOUNT
168#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
175 return __popcnt16(
v);
179 return __popcnt16(
v);
183#if Q_PROCESSOR_WORDSIZE == 8
184 return __popcnt64(
v);
194#ifndef QT_POPCOUNT_CONSTEXPR
195#define QT_POPCOUNT_CONSTEXPR constexpr
196#define QT_POPCOUNT_RELAXED_CONSTEXPR constexpr
203#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
204 return std::popcount(
v);
205#elif defined QALGORITHMS_USE_BUILTIN_POPCOUNT
206 return QAlgorithmsPrivate::qt_builtin_popcount(
v);
218#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
219 return std::popcount(
v);
220#elif defined QALGORITHMS_USE_BUILTIN_POPCOUNT
221 return QAlgorithmsPrivate::qt_builtin_popcount(
v);
230#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
231 return std::popcount(
v);
232#elif defined QALGORITHMS_USE_BUILTIN_POPCOUNT
233 return QAlgorithmsPrivate::qt_builtin_popcount(
v);
243#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
244 return std::popcount(
v);
245#elif defined QALGORITHMS_USE_BUILTIN_POPCOUNTLL
246 return QAlgorithmsPrivate::qt_builtin_popcountll(
v);
263#if defined(QALGORITHMS_USE_BUILTIN_POPCOUNT)
264#undef QALGORITHMS_USE_BUILTIN_POPCOUNT
266#undef QT_POPCOUNT_CONSTEXPR
275 if (
v & 0x0000FFFF)
c -= 16;
276 if (
v & 0x00FF00FF)
c -= 8;
277 if (
v & 0x0F0F0F0F)
c -= 4;
278 if (
v & 0x33333333)
c -= 2;
279 if (
v & 0x55555555)
c -= 1;
295 if (
v & 0x0000000F)
c -= 4;
296 if (
v & 0x00000033)
c -= 2;
297 if (
v & 0x00000055)
c -= 1;
306 if (
v & 0x000000FF)
c -= 8;
307 if (
v & 0x00000F0F)
c -= 4;
308 if (
v & 0x00003333)
c -= 2;
309 if (
v & 0x00005555)
c -= 1;
321#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
322 return std::countr_zero(
v);
323#elif defined(QT_HAS_BUILTIN_CTZ)
324 return v ? QAlgorithmsPrivate::qt_builtin_ctz(
v) : 32U;
332#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
333 return std::countr_zero(
v);
334#elif defined(QT_HAS_BUILTIN_CTZ)
335 return v ? QAlgorithmsPrivate::qt_builtin_ctz(
v) : 8U;
343#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
344 return std::countr_zero(
v);
345#elif defined(QT_HAS_BUILTIN_CTZS)
346 return v ? QAlgorithmsPrivate::qt_builtin_ctzs(
v) : 16U;
354#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
355 return std::countr_zero(
v);
356#elif defined(QT_HAS_BUILTIN_CTZLL)
357 return v ? QAlgorithmsPrivate::qt_builtin_ctzll(
v) : 64;
370#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
371 return std::countl_zero(
v);
372#elif defined(QT_HAS_BUILTIN_CLZ)
373 return v ? QAlgorithmsPrivate::qt_builtin_clz(
v) : 32U;
387#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
388 return std::countl_zero(
v);
389#elif defined(QT_HAS_BUILTIN_CLZ)
390 return v ? QAlgorithmsPrivate::qt_builtin_clz(
v)-24U : 8U;
401#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
402 return std::countl_zero(
v);
403#elif defined(QT_HAS_BUILTIN_CLZS)
404 return v ? QAlgorithmsPrivate::qt_builtin_clzs(
v) : 16U;
416#if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L
417 return std::countl_zero(
v);
418#elif defined(QT_HAS_BUILTIN_CLZLL)
419 return v ? QAlgorithmsPrivate::qt_builtin_clzll(
v) : 64U;
436#undef QT_POPCOUNT_RELAXED_CONSTEXPR
Combined button and popup list for selecting options.
constexpr uint qConstexprCountTrailingZeroBits(quint32 v) noexcept
QT_BEGIN_NAMESPACE Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
QT_POPCOUNT_RELAXED_CONSTEXPR uint qCountLeadingZeroBits(quint32 v) noexcept
constexpr uint qCountTrailingZeroBits(quint32 v) noexcept
#define QT_POPCOUNT_CONSTEXPR
#define QT_POPCOUNT_RELAXED_CONSTEXPR
Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR uint qPopulationCount(quint32 v) noexcept
#define Q_DECL_CONST_FUNCTION
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
unsigned long long quint64