]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Do not use cpuid.h on Windows
authorPavel P <pavlov.pavel@gmail.com>
Tue, 17 Jan 2023 02:50:14 +0000 (05:50 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 19 Jan 2023 23:29:54 +0000 (00:29 +0100)
According to msdn docs __cpuid/__cpuidex/_xgetbv are provided by intrin.h and should be used on windows

arch/x86/x86_features.c

index 0de8349941c76c0e52a8a3e191d0dd58e7575c8e..d1ac51c55c799062b546cc5c91569ddafad69fdc 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "../../zbuild.h"
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 #  include <intrin.h>
 #else
 // Newer versions of GCC and clang come with cpuid.h
@@ -32,7 +32,7 @@ Z_INTERNAL int x86_cpu_has_os_save_ymm;
 Z_INTERNAL int x86_cpu_has_os_save_zmm;
 
 static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
-#ifdef _MSC_VER
+#ifdef _WIN32
     unsigned int registers[4];
     __cpuid((int *)registers, info);
 
@@ -46,7 +46,7 @@ static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx,
 }
 
 static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
-#ifdef _MSC_VER
+#ifdef _WIN32
     unsigned int registers[4];
     __cpuidex((int *)registers, info, subinfo);
 
@@ -60,7 +60,7 @@ static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx,
 }
 
 static inline uint64_t xgetbv(unsigned int xcr) {
-#ifdef _MSC_VER
+#ifdef _WIN32
     return _xgetbv(xcr);
 #else
     uint32_t eax, edx;