diff options
Diffstat (limited to 'src/corelib/tools/qbitarray.cpp')
-rw-r--r-- | src/corelib/tools/qbitarray.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 169f0ce2c8..da2f48c071 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -194,7 +194,12 @@ int QBitArray::count(bool on) const // it's the QByteArray implicit NUL, so it will not change the bit count const quint8 *const end = reinterpret_cast<const quint8 *>(d.end()); - while (bits + 3 <= end) { + while (bits + 7 <= end) { + quint64 v = qUnalignedLoad<quint64>(bits); + bits += 8; + numBits += int(qPopulationCount(v)); + } + if (bits + 3 <= end) { quint32 v = qUnalignedLoad<quint32>(bits); bits += 4; numBits += int(qPopulationCount(v)); |