ZLIB_INTERNAL int x86_cpu_has_sse42;
ZLIB_INTERNAL int x86_cpu_has_pclmulqdq;
+#ifdef _MSC_VER
+#include <intrin.h>\r
+#define CPU_PROCINFO_AND_FEATUREBITS 1\r
+\r
+void ZLIB_INTERNAL x86_check_features(void) {\r
+ unsigned int registers[4];\r
+ __cpuid(registers, CPU_PROCINFO_AND_FEATUREBITS);\r
+\r
+ unsigned int ecx = registers[2];\r
+ unsigned int edx = registers[3];\r
+\r
+ x86_cpu_has_sse2 = edx & 0x4000000;
+ x86_cpu_has_sse42 = ecx & 0x100000;
+ x86_cpu_has_pclmulqdq = ecx & 0x2;\r
+}
+#else
void ZLIB_INTERNAL x86_check_features(void) {
unsigned eax, ebx, ecx, edx;
: "+a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
#endif
);
-
x86_cpu_has_sse2 = edx & 0x4000000;
x86_cpu_has_sse42 = ecx & 0x100000;
x86_cpu_has_pclmulqdq = ecx & 0x2;
}
+#endif
\ No newline at end of file