1
0
mirror of https://github.com/RPCS3/soundtouch.git synced 2024-11-09 20:33:03 +01:00

Changed x86 optimization flagging for non-win & non-linux x86 support

This commit is contained in:
oparviai 2009-01-11 11:36:36 +00:00
parent 9aaf4210af
commit 327906e23b
2 changed files with 18 additions and 17 deletions

View File

@ -87,14 +87,16 @@ namespace soundtouch
#endif #endif
/// Define this to allow CPU-specific assembler optimizations. Notice that #if (WIN32 || __i386__ || __x86_64__)
/// having this enabled on non-x86 platforms doesn't matter; the compiler can /// Define this to allow X86-specific assembler/intrinsic optimizations.
/// drop unsupported extensions on different platforms automatically. /// Notice that library contains also usual C++ versions of each of these
/// However, if you're having difficulties getting the optimized routines /// these routines, so if you're having difficulties getting the optimized
/// compiled with your compler (e.g. some gcc compiler versions may be picky), /// routines compiled for whatever reason, you may disable these optimizations
/// you may wish to disable the optimizations to make the library compile. /// to make the library compile.
#define ALLOW_OPTIMIZATIONS 1
#define ALLOW_X86_OPTIMIZATIONS 1
#endif
// If defined, allows the SIMD-optimized routines to take minor shortcuts // If defined, allows the SIMD-optimized routines to take minor shortcuts
// for improved performance. Undefine to require faithfully similar SIMD // for improved performance. Undefine to require faithfully similar SIMD
@ -113,11 +115,9 @@ namespace soundtouch
#error "conflicting sample types defined" #error "conflicting sample types defined"
#endif // FLOAT_SAMPLES #endif // FLOAT_SAMPLES
#ifdef ALLOW_OPTIMIZATIONS #ifdef ALLOW_X86_OPTIMIZATIONS
#if (WIN32 || __i386__ || __x86_64__) // Allow MMX optimizations
// Allow MMX optimizations #define ALLOW_MMX 1
#define ALLOW_MMX 1
#endif
#endif #endif
#else #else
@ -127,15 +127,13 @@ namespace soundtouch
// data type for sample accumulation: Use double to utilize full precision. // data type for sample accumulation: Use double to utilize full precision.
typedef double LONG_SAMPLETYPE; typedef double LONG_SAMPLETYPE;
#ifdef ALLOW_OPTIMIZATIONS #ifdef ALLOW_X86_OPTIMIZATIONS
// Allow 3DNow! and SSE optimizations // Allow 3DNow! and SSE optimizations
#if WIN32 #if WIN32
#define ALLOW_3DNOW 1 #define ALLOW_3DNOW 1
#endif #endif
#if (WIN32 || __i386__ || __x86_64__) #define ALLOW_SSE 1
#define ALLOW_SSE 1
#endif
#endif #endif
#endif // INTEGER_SAMPLES #endif // INTEGER_SAMPLES

View File

@ -43,6 +43,7 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include "cpu_detect.h" #include "cpu_detect.h"
#include "STTypes.h"
#ifndef __GNUC__ #ifndef __GNUC__
#error wrong platform - this source code file is for the GNU C compiler. #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. /// Checks which instruction set extensions are supported by the CPU.
uint detectCPUextensions(void) uint detectCPUextensions(void)
{ {
#ifndef __i386__ #ifndef ALLOW_X86_OPTIMIZATIONS
return 0; // always disable extensions on non-x86 platforms. return 0; // always disable extensions on non-x86 platforms.
#else #else
uint res = 0; uint res = 0;