QBitArray: correct inline keyword
The mutable operator[] method was marked as inline only at the definition, not the declaration. This is known to cause compilation failures on MinGW when the function is used in other inline implementation (cf. e.g. QTBUG-56459). It's not, atm, but fix the issue proactively. Manual conflict resolutions: - also at(), ~~~Bit() and op[] const needed treatment in this Qt version - remove inline keyword on fill() outside class body for consistency Pick-to: 5.15 Change-Id: If805122d9f8dbd72641173509c4b860c20fc1cdc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 7310d2bd5562d1a88b69a544ab9b88c13cc3f978) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9d9b912adea3dd96cf51bb54b7a5586077009fe3) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit a054691ac523e2c4f8cc846432399e73675296f2) (cherry picked from commit fc48b9e4af1052e3c6ddabcf4ca5a21caef15427)
This commit is contained in:
parent
4b0e877b3c
commit
3a32654c09
@ -77,15 +77,15 @@ public:
|
||||
inline bool isDetached() const { return d.isDetached(); }
|
||||
inline void clear() { d.clear(); }
|
||||
|
||||
bool testBit(qsizetype i) const;
|
||||
void setBit(qsizetype i);
|
||||
void setBit(qsizetype i, bool val);
|
||||
void clearBit(qsizetype i);
|
||||
bool toggleBit(qsizetype i);
|
||||
inline bool testBit(qsizetype i) const;
|
||||
inline void setBit(qsizetype i);
|
||||
inline void setBit(qsizetype i, bool val);
|
||||
inline void clearBit(qsizetype i);
|
||||
inline bool toggleBit(qsizetype i);
|
||||
|
||||
bool at(qsizetype i) const;
|
||||
QBitRef operator[](qsizetype i);
|
||||
bool operator[](qsizetype i) const;
|
||||
inline bool at(qsizetype i) const;
|
||||
inline QBitRef operator[](qsizetype i);
|
||||
inline bool operator[](qsizetype i) const;
|
||||
|
||||
QBitArray &operator&=(const QBitArray &);
|
||||
QBitArray &operator|=(const QBitArray &);
|
||||
@ -110,35 +110,35 @@ public:
|
||||
inline DataPtr &data_ptr() { return d.data_ptr(); }
|
||||
};
|
||||
|
||||
inline bool QBitArray::fill(bool aval, qsizetype asize)
|
||||
bool QBitArray::fill(bool aval, qsizetype asize)
|
||||
{ *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; }
|
||||
|
||||
Q_CORE_EXPORT QBitArray operator&(const QBitArray &, const QBitArray &);
|
||||
Q_CORE_EXPORT QBitArray operator|(const QBitArray &, const QBitArray &);
|
||||
Q_CORE_EXPORT QBitArray operator^(const QBitArray &, const QBitArray &);
|
||||
|
||||
inline bool QBitArray::testBit(qsizetype i) const
|
||||
bool QBitArray::testBit(qsizetype i) const
|
||||
{ Q_ASSERT(size_t(i) < size_t(size()));
|
||||
return (*(reinterpret_cast<const uchar*>(d.constData())+1+(i>>3)) & (1 << (i & 7))) != 0; }
|
||||
|
||||
inline void QBitArray::setBit(qsizetype i)
|
||||
void QBitArray::setBit(qsizetype i)
|
||||
{ Q_ASSERT(size_t(i) < size_t(size()));
|
||||
*(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) |= uchar(1 << (i & 7)); }
|
||||
|
||||
inline void QBitArray::clearBit(qsizetype i)
|
||||
void QBitArray::clearBit(qsizetype i)
|
||||
{ Q_ASSERT(size_t(i) < size_t(size()));
|
||||
*(reinterpret_cast<uchar*>(d.data())+1+(i>>3)) &= ~uchar(1 << (i & 7)); }
|
||||
|
||||
inline void QBitArray::setBit(qsizetype i, bool val)
|
||||
void QBitArray::setBit(qsizetype i, bool val)
|
||||
{ if (val) setBit(i); else clearBit(i); }
|
||||
|
||||
inline bool QBitArray::toggleBit(qsizetype i)
|
||||
bool QBitArray::toggleBit(qsizetype i)
|
||||
{ Q_ASSERT(size_t(i) < size_t(size()));
|
||||
uchar b = uchar(1<<(i&7)); uchar* p = reinterpret_cast<uchar*>(d.data())+1+(i>>3);
|
||||
uchar c = uchar(*p&b); *p^=b; return c!=0; }
|
||||
|
||||
inline bool QBitArray::operator[](qsizetype i) const { return testBit(i); }
|
||||
inline bool QBitArray::at(qsizetype i) const { return testBit(i); }
|
||||
bool QBitArray::operator[](qsizetype i) const { return testBit(i); }
|
||||
bool QBitArray::at(qsizetype i) const { return testBit(i); }
|
||||
|
||||
class Q_CORE_EXPORT QBitRef
|
||||
{
|
||||
@ -155,7 +155,7 @@ public:
|
||||
QBitRef &operator=(bool val) { a.setBit(i, val); return *this; }
|
||||
};
|
||||
|
||||
inline QBitRef QBitArray::operator[](qsizetype i)
|
||||
QBitRef QBitArray::operator[](qsizetype i)
|
||||
{ Q_ASSERT(i >= 0); return QBitRef(*this, i); }
|
||||
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
|
Loading…
x
Reference in New Issue
Block a user