diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-03-25 17:30:26 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-26 21:44:15 +0100 |
commit | bafd3fdf1c72040abbf7ddf354f6b1c15c9985a4 (patch) | |
tree | dedba8e8fc3ae3f51a28ef485149d71549080f47 /src | |
parent | 03d057ff01332333b98f5298c3d0bd85b5604ac9 (diff) |
Make the inline CPU detection functions also static
Since qCpuHasFeature() checks the static qCompilerCpuFeatures variable
and that variable's value might change depending on the compiler flags,
it's best to ensure that the function is not subject to link-time
merging. That would be bad if it happened when qCpuHasFeature() was used
from a file with higher CPU compiler settings than the default, as it
would incorrectly conclude that certain features are always available.
Change-Id: I8bacde056fb89869ec1d306a163742e72522315e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index b9d546452f..98eb473da0 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -228,7 +228,7 @@ static const uint qCompilerCpuFeatures = 0 extern Q_CORE_EXPORT QBasicAtomicInt qt_cpu_features; Q_CORE_EXPORT void qDetectCpuFeatures(); -inline uint qCpuFeatures() +static inline uint qCpuFeatures() { int features = qt_cpu_features.load(); if (Q_UNLIKELY(features == 0)) { @@ -239,7 +239,7 @@ inline uint qCpuFeatures() return uint(features); } -inline uint qCpuHasFeature(CPUFeatures feature) +static inline uint qCpuHasFeature(CPUFeatures feature) { return qCompilerCpuFeatures & feature || qCpuFeatures() & feature; } |