aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects/pshifter.cpp
diff options
context:
space:
mode:
authorRaulshc <[email protected]>2019-08-18 19:12:38 +0200
committerRaulshc <[email protected]>2019-08-18 19:12:38 +0200
commit550f1dce1fa00bc084e6dacbb40fdafb6867a015 (patch)
tree75b8af0e8e993540a8bfb32379a621f2efb174f4 /alc/effects/pshifter.cpp
parentff66061091baedaa7d677ede65aba592c8f8aa5d (diff)
Move double2int function
Move inline double2int function to alnumeric.h from pshifter.cpp
Diffstat (limited to 'alc/effects/pshifter.cpp')
-rw-r--r--alc/effects/pshifter.cpp35
1 files changed, 1 insertions, 34 deletions
diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp
index 819e510c..0ba0b496 100644
--- a/alc/effects/pshifter.cpp
+++ b/alc/effects/pshifter.cpp
@@ -34,6 +34,7 @@
#include "alcmain.h"
#include "alcomplex.h"
#include "alcontext.h"
+#include "alnumeric.h"
#include "alu.h"
@@ -48,40 +49,6 @@ using complex_d = std::complex<double>;
#define STFT_STEP (STFT_SIZE / OVERSAMP)
#define FIFO_LATENCY (STFT_STEP * (OVERSAMP-1))
-inline int double2int(double d)
-{
-#if defined(HAVE_SSE_INTRINSICS)
- return _mm_cvttsd_si32(_mm_set_sd(d));
-
-#elif ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) && \
- !defined(__SSE2_MATH__)) || (defined(_MSC_VER) && defined(_M_IX86_FP) && _M_IX86_FP < 2)
-
- int sign, shift;
- int64_t mant;
- union {
- double d;
- int64_t i64;
- } conv;
-
- conv.d = d;
- sign = (conv.i64>>63) | 1;
- shift = ((conv.i64>>52)&0x7ff) - (1023+52);
-
- /* Over/underflow */
- if UNLIKELY(shift >= 63 || shift < -52)
- return 0;
-
- mant = (conv.i64&0xfffffffffffff_i64) | 0x10000000000000_i64;
- if LIKELY(shift < 0)
- return (int)(mant >> -shift) * sign;
- return (int)(mant << shift) * sign;
-
-#else
-
- return static_cast<int>(d);
-#endif
-}
-
/* Define a Hann window, used to filter the STFT input and output. */
/* Making this constexpr seems to require C++14. */
std::array<ALdouble,STFT_SIZE> InitHannWindow()