summaryrefslogtreecommitdiff
path: root/src/utils/cpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/cpu.cpp')
-rw-r--r--src/utils/cpu.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp
index e57956c06..91f49f5a7 100644
--- a/src/utils/cpu.cpp
+++ b/src/utils/cpu.cpp
@@ -32,7 +32,10 @@
#include "debug.h"
-int mCpuFlags = 0;
+namespace
+{
+ uint32_t mCpuFlags;
+} // namespace
void Cpu::detect()
{
@@ -99,16 +102,20 @@ void Cpu::detect()
}
}
fclose(file);
- logger->log("cpu features was not detected");
+ if (logger)
+ logger->log("cpu features was not detected");
#else // OTHER
- logger->log("cpu features not supported");
+ if (logger)
+ logger->log("cpu features not supported");
#endif // (defined(__amd64__) || defined(__i386__)) && defined(__GNUC__)
// && (GCC_VERSION >= 40800) && !defined(ANDROID)
}
void Cpu::printFlags()
{
+ if (!logger)
+ return;
std::string str("CPU features:");
if (mCpuFlags & FEATURE_MMX)
str.append(" mmx");
@@ -128,3 +135,8 @@ void Cpu::printFlags()
str.append(" avx2");
logger->log(str);
}
+
+uint32_t Cpu::getFlags()
+{
+ return mCpuFlags;
+}