diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2022-01-15 11:30:16 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2022-01-15 11:30:16 -0800 |
commit | 38ad16aac5b42457759614eded0502ec6255f845 (patch) | |
tree | 62742659af4d541fe26a087746bc8679b938514f | |
parent | eb1f5e89dea7f5ad74f93dbe57fae442fdddc116 (diff) | |
download | psutil-38ad16aac5b42457759614eded0502ec6255f845.tar.gz |
add macros to detect x86 / x64 archs
-rw-r--r-- | psutil/arch/windows/cpu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/psutil/arch/windows/cpu.c b/psutil/arch/windows/cpu.c index 7465638a..11b50fcf 100644 --- a/psutil/arch/windows/cpu.c +++ b/psutil/arch/windows/cpu.c @@ -7,6 +7,9 @@ #include <Python.h> #include <windows.h> #include <PowrProf.h> +#if defined(_M_IX86) || defined(_M_X64) + #include <intrin.h> // __cpuid +#endif #include "../../_psutil_common.h" @@ -420,6 +423,7 @@ error: */ PyObject * psutil_cpuid(PyObject *self, PyObject *args) { +#if defined(_M_IX86) || defined(_M_X64) int cpuInfo[4] = {-1}; char cpuString[0x20]; unsigned nIds; @@ -442,4 +446,6 @@ psutil_cpuid(PyObject *self, PyObject *args) { *((int*)(cpuString + 4)) = cpuInfo[3]; *((int*)(cpuString + 8)) = cpuInfo[2]; return Py_BuildValue("s", cpuString); +#endif // _M_IX86 || _M_X64 + Py_RETURN_NONE; } |