From 6bd2358105bddcd73a4a91c806da7ba30988d9b8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Nov 2023 09:47:53 -0800 Subject: [PATCH] QBitArray: move a few methods more into the class body This reduces the size of the header. I renamed the arguments for fill() because "size" would shadow a member function. Change-Id: I85b3fc2dd45c4693be13fffd1795b706b92e0965 Reviewed-by: Marc Mutz Reviewed-by: Ahmad Samir --- src/corelib/tools/qbitarray.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index b29a173fa8..b5b6638507 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -69,9 +69,9 @@ public: return cl; } - bool at(qsizetype i) const; + bool at(qsizetype i) const { return testBit(i); } QBitRef operator[](qsizetype i); - bool operator[](qsizetype i) const; + bool operator[](qsizetype i) const { return testBit(i); } QBitArray &operator&=(const QBitArray &); QBitArray &operator|=(const QBitArray &); @@ -81,7 +81,8 @@ public: inline bool operator==(const QBitArray &other) const { return d == other.d; } inline bool operator!=(const QBitArray &other) const { return d != other.d; } - inline bool fill(bool val, qsizetype size = -1); + bool fill(bool aval, qsizetype asize = -1) + { *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } void fill(bool val, qsizetype first, qsizetype last); inline void truncate(qsizetype pos) { if (pos < size()) resize(pos); } @@ -96,15 +97,11 @@ public: inline DataPtr &data_ptr() { return d.data_ptr(); } }; -inline 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::operator[](qsizetype i) const { return testBit(i); } -inline bool QBitArray::at(qsizetype i) const { return testBit(i); } class Q_CORE_EXPORT QBitRef {