QSemaphore: add minor optimization for 64-bit Linux systems

Since we won't use the high bit of the low 32-bit word at all, we don't
need the AND with 0x7fffffff either. Just cast.

Change-Id: I72f5230ad59948f784eafffd151aa5a7dee995db
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2018-03-10 11:26:04 -08:00 committed by Aapo Keskimolo
parent 081c001deb
commit dabc76de80

View File

@ -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);
}