aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c1
-rw-r--r--Alc/ALu.c1
-rw-r--r--Alc/converter.c1
-rw-r--r--Alc/fpu_modes.h37
-rw-r--r--Alc/helpers.c5
-rw-r--r--OpenAL32/Include/alMain.h32
-rw-r--r--OpenAL32/alAuxEffectSlot.c1
7 files changed, 44 insertions, 34 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 5297af30..3b175b66 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -42,6 +42,7 @@
#include "alu.h"
#include "alconfig.h"
+#include "fpu_modes.h"
#include "cpu_caps.h"
#include "compat.h"
#include "threads.h"
diff --git a/Alc/ALu.c b/Alc/ALu.c
index e0496513..2fe579b9 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -39,6 +39,7 @@
#include "bformatdec.h"
#include "static_assert.h"
+#include "fpu_modes.h"
#include "cpu_caps.h"
#include "mixer_defs.h"
#include "bsinc_inc.h"
diff --git a/Alc/converter.c b/Alc/converter.c
index 8cba04a1..157073f2 100644
--- a/Alc/converter.c
+++ b/Alc/converter.c
@@ -3,6 +3,7 @@
#include "converter.h"
+#include "fpu_modes.h"
#include "mixer_defs.h"
diff --git a/Alc/fpu_modes.h b/Alc/fpu_modes.h
new file mode 100644
index 00000000..750252fc
--- /dev/null
+++ b/Alc/fpu_modes.h
@@ -0,0 +1,37 @@
+#ifndef FPU_MODES_H
+#define FPU_MODES_H
+
+#ifdef HAVE_FENV_H
+#include <fenv.h>
+#endif
+
+
+typedef struct FPUCtl {
+#ifdef HAVE_FENV_H
+ fenv_t flt_env;
+#ifdef _WIN32
+ int round_mode;
+#endif
+#else
+ int state;
+#endif
+#ifdef HAVE_SSE
+ int sse_state;
+#endif
+} FPUCtl;
+void SetMixerFPUMode(FPUCtl *ctl);
+void RestoreFPUMode(const FPUCtl *ctl);
+
+#ifdef __GNUC__
+/* Use an alternate macro set with GCC to avoid accidental continue or break
+ * statements within the mixer mode.
+ */
+#define START_MIXER_MODE() __extension__({ FPUCtl _oldMode; SetMixerFPUMode(&_oldMode)
+#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); })
+#else
+#define START_MIXER_MODE() do { FPUCtl _oldMode; SetMixerFPUMode(&_oldMode)
+#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); } while(0)
+#endif
+#define LEAVE_MIXER_MODE() RestoreFPUMode(&_oldMode)
+
+#endif /* FPU_MODES_H */
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 0f69b29e..238569d6 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -109,6 +109,7 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
#include "alMain.h"
#include "alu.h"
#include "cpu_caps.h"
+#include "fpu_modes.h"
#include "atomic.h"
#include "uintmap.h"
#include "vector.h"
@@ -295,7 +296,7 @@ void FillCPUCaps(int capfilter)
void SetMixerFPUMode(FPUCtl *ctl)
{
#ifdef HAVE_FENV_H
- fegetenv(STATIC_CAST(fenv_t, ctl));
+ fegetenv(&ctl->flt_env);
#ifdef _WIN32
/* HACK: A nasty bug in MinGW-W64 causes fegetenv and fesetenv to not save
* and restore the FPU rounding mode, so we have to do it manually. Don't
@@ -348,7 +349,7 @@ void SetMixerFPUMode(FPUCtl *ctl)
void RestoreFPUMode(const FPUCtl *ctl)
{
#ifdef HAVE_FENV_H
- fesetenv(STATIC_CAST(fenv_t, ctl));
+ fesetenv(&ctl->flt_env);
#ifdef _WIN32
fesetround(ctl->round_mode);
#endif
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index ea797053..5b4519eb 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -13,10 +13,6 @@
#include <strings.h>
#endif
-#ifdef HAVE_FENV_H
-#include <fenv.h>
-#endif
-
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/alext.h"
@@ -803,34 +799,6 @@ void ALCcontext_DeferUpdates(ALCcontext *context);
void ALCcontext_ProcessUpdates(ALCcontext *context);
-typedef struct {
-#ifdef HAVE_FENV_H
- DERIVE_FROM_TYPE(fenv_t);
-#ifdef _WIN32
- int round_mode;
-#endif
-#else
- int state;
-#endif
-#ifdef HAVE_SSE
- int sse_state;
-#endif
-} FPUCtl;
-void SetMixerFPUMode(FPUCtl *ctl);
-void RestoreFPUMode(const FPUCtl *ctl);
-#ifdef __GNUC__
-/* Use an alternate macro set with GCC to avoid accidental continue or break
- * statements within the mixer mode.
- */
-#define START_MIXER_MODE() __extension__({ FPUCtl _oldMode; SetMixerFPUMode(&_oldMode);
-#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); })
-#else
-#define START_MIXER_MODE() do { FPUCtl _oldMode; SetMixerFPUMode(&_oldMode);
-#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); } while(0)
-#endif
-#define LEAVE_MIXER_MODE() RestoreFPUMode(&_oldMode)
-
-
typedef struct ll_ringbuffer ll_ringbuffer_t;
typedef struct ll_ringbuffer_data {
char *buf;
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 12092100..2dcf7125 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -32,6 +32,7 @@
#include "alListener.h"
#include "alSource.h"
+#include "fpu_modes.h"
#include "almalloc.h"