[PATCH] Fix compilation on non-Windows x86-32.
Andreas Schlick
schlick at lavabit.com
Thu Sep 13 10:44:50 PDT 2012
cpusupport.h used __cpuid() from the Windows specific header file intrin.h
which is not available under gcc. But we can use __get_cpuid() from cpuid.h
instead.
---
src/cpusupport.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/cpusupport.h b/src/cpusupport.h
index 1986d31..5e42337 100644
--- a/src/cpusupport.h
+++ b/src/cpusupport.h
@@ -32,7 +32,9 @@
# if !defined(__SSE__) || defined(_M_X64) || defined(__amd64__)
# define query_cpu_support() 0
#else
-# include <intrin.h>
+
+#if defined WIN32 || defined _WIN32
+#include <intrin.h>
static inline int query_cpu_support(void)
{
int buffer[4];
@@ -43,5 +45,19 @@ static inline int query_cpu_support(void)
# endif
;
}
+#else
+#include <cpuid.h>
+static inline int query_cpu_support(void)
+{
+ unsigned int eax, ebx, ecx, edx=0;
+ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
+ return ((edx & 1<<25) == 0) /*SSE*/
+#ifdef __SSE2__
+ + ((edx & 1<<26) == 0) /*SSE2*/
+#endif
+ ;
+}
+#endif
+
# endif
#endif
--
1.7.12
--MP_/BZrHB8rBC9uIQo4DsIolmT/--
More information about the opus
mailing list