18#include <QtCore/private/qglobal_p.h>
19#include <QtCore/qatomic.h>
57 inline void t()
const { }
83 IndexMask = 0x00ffffff,
84 SerialMask = ~IndexMask & ~0x80000000,
85 SerialCounter = IndexMask + 1,
90 static const int Sizes[BlockCount];
110template <
typename T,
typename ConstantsType = QFreeListDefaultConstants>
119 static inline int blockfor(
int &
x)
121 for (
int i = 0;
i < ConstantsType::BlockCount; ++
i) {
122 int size = ConstantsType::Sizes[
i];
127 Q_UNREACHABLE_RETURN(-1);
141 static inline int incrementserial(
int o,
int n)
143 return int((
uint(
n) & ConstantsType::IndexMask) | ((
uint(
o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask));
159 inline ConstReferenceType
at(
int x)
const;
170template <
typename T,
typename ConstantsType>
174 _next(ConstantsType::InitialNextValue)
177template <
typename T,
typename ConstantsType>
180 for (
int i = 0;
i < ConstantsType::BlockCount; ++
i)
181 delete [] _v[
i].loadAcquire();
184template <
typename T,
typename ConstantsType>
187 const int block = blockfor(
x);
188 return (_v[block].loadRelaxed())[
x].t();
191template <
typename T,
typename ConstantsType>
194 const int block = blockfor(
x);
195 return (_v[block].loadRelaxed())[
x].t();
198template <
typename T,
typename ConstantsType>
204 id = _next.loadAcquire();
206 at =
id & ConstantsType::IndexMask;
207 const int block = blockfor(
at);
208 v = _v[block].loadAcquire();
211 v = allocate((
id & ConstantsType::IndexMask) -
at, ConstantsType::Sizes[block]);
212 if (!_v[block].testAndSetRelease(
nullptr,
v)) {
215 v = _v[block].loadAcquire();
220 newid =
v[
at].next.loadRelaxed() | (
id & ~ConstantsType::IndexMask);
221 }
while (!_next.testAndSetRelease(
id, newid));
226 return id & ConstantsType::IndexMask;
229template <
typename T,
typename ConstantsType>
232 int at =
id & ConstantsType::IndexMask;
233 const int block = blockfor(
at);
238 x = _next.loadAcquire();
239 v[
at].next.storeRelaxed(
x & ConstantsType::IndexMask);
241 newid = incrementserial(
x,
id);
242 }
while (!_next.testAndSetRelease(
x, newid));
\macro Q_ATOMIC_INTnn_IS_SUPPORTED
ReferenceType operator[](int x)
ConstReferenceType at(int x) const
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
#define Q_AUTOTEST_EXPORT
const T & ConstReferenceType
ConstReferenceType t() const