65 #if defined(__GNUC__) && defined(__SSE__)
67 #include <xmmintrin.h>
68 static OPUS_INLINE opus_int32 float2int(
float x) {
return _mm_cvt_ss2si(_mm_set_ss(x));}
70 #elif defined(HAVE_LRINTF)
79 #define _ISOC9X_SOURCE 1
80 #define _ISOC99_SOURCE 1
82 #define __USE_ISOC9X 1
83 #define __USE_ISOC99 1
86 #define float2int(x) lrintf(x)
88 #elif (defined(HAVE_LRINT))
90 #define _ISOC9X_SOURCE 1
91 #define _ISOC99_SOURCE 1
93 #define __USE_ISOC9X 1
94 #define __USE_ISOC99 1
97 #define float2int(x) lrint(x)
99 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_X64)
100 #include <xmmintrin.h>
102 __inline
long int float2int(
float value)
104 return _mm_cvtss_si32(_mm_load_ss(&value));
106 #elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_IX86)
114 float2int (
float flt)
127 #if (defined(__GNUC__) && defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L)
129 #warning "Don't have the functions lrint() and lrintf ()."
130 #warning "Replacing these functions with a standard C cast."
133 #define float2int(flt) ((int)(floor(.5f+flt)))
136 #ifndef DISABLE_FLOAT_API
137 static OPUS_INLINE opus_int16 FLOAT2INT16(
float x)
139 x = x*CELT_SIG_SCALE;
140 x = MAX32(x, -32768);
142 return (opus_int16)float2int(x);