diff --git a/include/STTypes.h b/include/STTypes.h index 09ccad6..3767f76 100644 --- a/include/STTypes.h +++ b/include/STTypes.h @@ -87,14 +87,16 @@ namespace soundtouch #endif - /// Define this to allow CPU-specific assembler optimizations. Notice that - /// having this enabled on non-x86 platforms doesn't matter; the compiler can - /// drop unsupported extensions on different platforms automatically. - /// However, if you're having difficulties getting the optimized routines - /// compiled with your compler (e.g. some gcc compiler versions may be picky), - /// you may wish to disable the optimizations to make the library compile. - #define ALLOW_OPTIMIZATIONS 1 + #if (WIN32 || __i386__ || __x86_64__) + /// Define this to allow X86-specific assembler/intrinsic optimizations. + /// Notice that library contains also usual C++ versions of each of these + /// these routines, so if you're having difficulties getting the optimized + /// routines compiled for whatever reason, you may disable these optimizations + /// to make the library compile. + #define ALLOW_X86_OPTIMIZATIONS 1 + + #endif // If defined, allows the SIMD-optimized routines to take minor shortcuts // for improved performance. Undefine to require faithfully similar SIMD @@ -113,11 +115,9 @@ namespace soundtouch #error "conflicting sample types defined" #endif // FLOAT_SAMPLES - #ifdef ALLOW_OPTIMIZATIONS - #if (WIN32 || __i386__ || __x86_64__) - // Allow MMX optimizations - #define ALLOW_MMX 1 - #endif + #ifdef ALLOW_X86_OPTIMIZATIONS + // Allow MMX optimizations + #define ALLOW_MMX 1 #endif #else @@ -127,15 +127,13 @@ namespace soundtouch // data type for sample accumulation: Use double to utilize full precision. typedef double LONG_SAMPLETYPE; - #ifdef ALLOW_OPTIMIZATIONS + #ifdef ALLOW_X86_OPTIMIZATIONS // Allow 3DNow! and SSE optimizations #if WIN32 #define ALLOW_3DNOW 1 #endif - #if (WIN32 || __i386__ || __x86_64__) - #define ALLOW_SSE 1 - #endif + #define ALLOW_SSE 1 #endif #endif // INTEGER_SAMPLES diff --git a/source/SoundTouch/cpu_detect_x86_gcc.cpp b/source/SoundTouch/cpu_detect_x86_gcc.cpp index 54b1910..2c797dc 100644 --- a/source/SoundTouch/cpu_detect_x86_gcc.cpp +++ b/source/SoundTouch/cpu_detect_x86_gcc.cpp @@ -43,6 +43,7 @@ #include #include #include "cpu_detect.h" +#include "STTypes.h" #ifndef __GNUC__ #error wrong platform - this source code file is for the GNU C compiler. @@ -72,8 +73,10 @@ void disableExtensions(uint dwDisableMask) /// Checks which instruction set extensions are supported by the CPU. uint detectCPUextensions(void) { -#ifndef __i386__ +#ifndef ALLOW_X86_OPTIMIZATIONS + return 0; // always disable extensions on non-x86 platforms. + #else uint res = 0;