aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/helpers.c40
-rw-r--r--OpenAL32/Include/alMain.h3
-rw-r--r--OpenAL32/Include/alu.h37
3 files changed, 43 insertions, 37 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 80d8e0e4..a6ed583f 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -166,6 +166,46 @@ void al_free(void *ptr)
#endif
}
+
+int SetMixerFPUMode(void)
+{
+#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
+ fpu_control_t fpuState, newState;
+ _FPU_GETCW(fpuState);
+ newState = fpuState&~(_FPU_EXTENDED|_FPU_DOUBLE|_FPU_SINGLE |
+ _FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO);
+ newState |= _FPU_SINGLE | _FPU_RC_ZERO;
+ if((CPUCapFlags&CPU_CAP_SSE))
+ newState |= 0x8000; /* flush-to-zero */
+ _FPU_SETCW(newState);
+#else
+ int fpuState;
+#if defined(HAVE__CONTROLFP)
+ fpuState = _controlfp(0, 0);
+ (void)_controlfp(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC);
+#elif defined(HAVE_FESETROUND)
+ fpuState = fegetround();
+#ifdef FE_TOWARDZERO
+ fesetround(FE_TOWARDZERO);
+#endif
+#endif
+#endif
+ return fpuState;
+}
+
+void RestoreFPUMode(int state)
+{
+#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
+ fpu_control_t fpuState = state;
+ _FPU_SETCW(fpuState);
+#elif defined(HAVE__CONTROLFP)
+ _controlfp(state, _MCW_RC|_MCW_DN|_MCW_PC);
+#elif defined(HAVE_FESETROUND)
+ fesetround(state);
+#endif
+}
+
+
#ifdef _WIN32
void pthread_once(pthread_once_t *once, void (*callback)(void))
{
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 6b8d5fab..49241eca 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -733,6 +733,9 @@ void *al_malloc(size_t alignment, size_t size);
void *al_calloc(size_t alignment, size_t size);
void al_free(void *ptr);
+int SetMixerFPUMode(void);
+void RestoreFPUMode(int state);
+
ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
ALuint StopThread(ALvoid *thread);
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 0c7cc28b..ece99b21 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -198,43 +198,6 @@ static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat
}
-static __inline int SetMixerFPUMode(void)
-{
-#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
- fpu_control_t fpuState, newState;
- _FPU_GETCW(fpuState);
- newState = fpuState&~(_FPU_EXTENDED|_FPU_DOUBLE|_FPU_SINGLE |
- _FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO);
- newState |= _FPU_SINGLE | _FPU_RC_ZERO;
- _FPU_SETCW(newState);
-#else
- int fpuState;
-#if defined(HAVE__CONTROLFP)
- fpuState = _controlfp(0, 0);
- (void)_controlfp(_RC_CHOP|_PC_24, _MCW_RC|_MCW_PC);
-#elif defined(HAVE_FESETROUND)
- fpuState = fegetround();
-#ifdef FE_TOWARDZERO
- fesetround(FE_TOWARDZERO);
-#endif
-#endif
-#endif
- return fpuState;
-}
-
-static __inline void RestoreFPUMode(int state)
-{
-#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
- fpu_control_t fpuState = state;
- _FPU_SETCW(fpuState);
-#elif defined(HAVE__CONTROLFP)
- _controlfp(state, _MCW_RC|_MCW_PC);
-#elif defined(HAVE_FESETROUND)
- fesetround(state);
-#endif
-}
-
-
static __inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector)
{
outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1];