shithub: opus

Download patch

ref: 7909d8af20883308bc9cb34ec5a292f91139d2b7
parent: 66d429ab5367b0111b936473e43a2bf9a3232d09
author: Rafaël Carré <[email protected]>
date: Thu Jul 26 10:24:25 EDT 2012

Guard _MSC_VER tests, remove FLOAT2INT16 when DISABLE_FLOAT_API.

--- a/celt/float_cast.h
+++ b/celt/float_cast.h
@@ -90,7 +90,7 @@
 #include <math.h>
 #define float2int(x) lrint(x)
 
-#elif (_MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64))
+#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN64) || defined (_WIN64))
         #include <xmmintrin.h>
 
         __inline long int float2int(float value)
@@ -97,7 +97,7 @@
         {
                 return _mm_cvtss_si32(_mm_load_ss(&value));
         }
-#elif (_MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32))
+#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined (WIN32) || defined (_WIN32))
         #include <math.h>
 
         /*      Win32 doesn't seem to have these functions.
@@ -127,6 +127,7 @@
         #define float2int(flt) ((int)(floor(.5+flt)))
 #endif
 
+#ifndef DISABLE_FLOAT_API
 static inline opus_int16 FLOAT2INT16(float x)
 {
    x = x*CELT_SIG_SCALE;
@@ -134,5 +135,6 @@
    x = MIN32(x, 32767);
    return (opus_int16)float2int(x);
 }
+#endif /* DISABLE_FLOAT_API */
 
 #endif /* FLOAT_CAST_H */
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -87,7 +87,7 @@
 #if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
 # if OPUS_GNUC_PREREQ(3,0)
 #  define OPUS_RESTRICT __restrict__
-# elif (_MSC_VER >= 1400)
+# elif (defined(_MSC_VER) && _MSC_VER >= 1400)
 #  define OPUS_RESTRICT __restrict
 # else
 #  define OPUS_RESTRICT