Commit 401c3e2f authored by Nick Terrell's avatar Nick Terrell Committed by Facebook Github Bot

Fix Windows macro detection

Summary:
The `__cpuid()` and `__cpuidex()` instructions are only available on
x86 and x64 https://fburl.com/ejw47bcl.

Reported in zstd [Issue#1313](https://github.com/facebook/zstd/issues/1313).

Reviewed By: Orvid

Differential Revision: D9800189

fbshipit-source-id: 8e846d2220e544b16547db16d21c7c7b0e21cefb
parent 68fc7770
...@@ -41,7 +41,7 @@ class CpuId { ...@@ -41,7 +41,7 @@ class CpuId {
// mode since inlining happens more likely, and it doesn't happen for // mode since inlining happens more likely, and it doesn't happen for
// statically linked binaries which don't depend on the PLT) // statically linked binaries which don't depend on the PLT)
FOLLY_ALWAYS_INLINE CpuId() { FOLLY_ALWAYS_INLINE CpuId() {
#ifdef _MSC_VER #if defined(_MSC_VER) && (FOLLY_X64 || defined(_M_IX86))
int reg[4]; int reg[4];
__cpuid(static_cast<int*>(reg), 0); __cpuid(static_cast<int*>(reg), 0);
const int n = reg[0]; const int n = reg[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment