Replace the qCpuHasFeature function with a macro

We want to make sure that there's a constant propagation from the static
variable that is filled in with the current code-generation options.
With most compilers in debug mode, we'd carry dead code. With MSVC, even
inlining is really bad even in release mode, and it doesn't perform
constant propagation even with __forceinline.

Change-Id: I7a95ff6622b864771243990bb5e205b2df0c33fc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Thiago Macieira 2013-12-04 17:14:07 -08:00 committed by The Qt Project
parent af47adede0
commit 13673ced44

View File

@ -239,11 +239,7 @@ static inline uint qCpuFeatures()
return uint(features);
}
static inline uint qCpuHasFeature(CPUFeatures feature)
{
return qCompilerCpuFeatures & feature || qCpuFeatures() & feature;
}
#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (feature)) || (qCpuFeatures() & (feature)))
#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i)