From: Pavel P Date: Tue, 17 Jan 2023 02:50:14 +0000 (+0300) Subject: Do not use cpuid.h on Windows X-Git-Tag: 2.1.0-beta1~101 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bf0f6e9a0f882909a1111d97381eec3ac931980;p=thirdparty%2Fzlib-ng.git Do not use cpuid.h on Windows According to msdn docs __cpuid/__cpuidex/_xgetbv are provided by intrin.h and should be used on windows --- diff --git a/arch/x86/x86_features.c b/arch/x86/x86_features.c index 0de83499..d1ac51c5 100644 --- a/arch/x86/x86_features.c +++ b/arch/x86/x86_features.c @@ -9,7 +9,7 @@ #include "../../zbuild.h" -#ifdef _MSC_VER +#ifdef _WIN32 # include #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;