diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index f4674fcc1d8..c2e4d7d9d14 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -140,6 +140,13 @@ static const quintptr futexNeedsWakeAllBit = static int futexAvailCounter(quintptr v) { // the low 31 bits + if (futexHasWaiterCount) { + // the high bit of the low word isn't used + Q_ASSERT((v & 0x80000000U) == 0); + + // so we can be a little faster + return int(unsigned(v)); + } return int(v & 0x7fffffffU); }