diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-08-13 02:53:12 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-08-13 02:53:12 -0400 |
commit | cd159fd1ec8ae64e6cd1b69854034560b5f1c419 (patch) | |
tree | 6c765f4cc49fbf35f68a3107b2408f512d015657 /celt | |
parent | 9f7e502e0683bfbf8bfe9ba48220df27c258bf9e (diff) | |
download | opus-cd159fd1ec8ae64e6cd1b69854034560b5f1c419.tar.gz |
Making gcc use SSE directly for float->int conversion when available
Diffstat (limited to 'celt')
-rw-r--r-- | celt/float_cast.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/celt/float_cast.h b/celt/float_cast.h index ed5a39b5..98b40abc 100644 --- a/celt/float_cast.h +++ b/celt/float_cast.h @@ -61,7 +61,13 @@ ** the config.h file. */ -#if (HAVE_LRINTF) +/* With GCC, when SSE is available, the fastest conversion is cvtss2si. */ +#if defined(__GNUC__) && defined(__SSE__) + +#include <xmmintrin.h> +static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_ss(x));} + +#elif defined(HAVE_LRINTF) /* These defines enable functionality introduced with the 1999 ISO C ** standard. They must be defined before the inclusion of math.h to |