summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-22 23:05:26 -0700
committerChris Robinson <[email protected]>2013-05-22 23:05:26 -0700
commitbe4a4d74686fffb0a7e38cb4b1cad9653d2ba00f (patch)
treecb05d3420407642a8d5862d2a50c70dc2efbda09
parenteb15b13ca16e4ecf254c2143f18b4d03d76179ab (diff)
Use fegetenv/fesetenv to backup and restore the FPU state
-rw-r--r--Alc/helpers.c8
-rw-r--r--OpenAL32/Include/alMain.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index a95e5ae3..25f85370 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -201,8 +201,8 @@ void al_free(void *ptr)
void SetMixerFPUMode(FPUCtl *ctl)
{
-#if defined(HAVE_FESETROUND)
- ctl->state = fegetround();
+#ifdef HAVE_FENV_H
+ fegetenv(STATIC_CAST(fenv_t, ctl));
#if defined(__GNUC__) && defined(HAVE_SSE)
if((CPUCapFlags&CPU_CAP_SSE))
__asm__ __volatile__("stmxcsr %0" : "=m" (*&ctl->sse_state));
@@ -245,8 +245,8 @@ void SetMixerFPUMode(FPUCtl *ctl)
void RestoreFPUMode(const FPUCtl *ctl)
{
-#if defined(HAVE_FESETROUND)
- fesetround(ctl->state);
+#ifdef HAVE_FENV_H
+ fesetenv(STATIC_CAST(fenv_t, ctl));
#if defined(__GNUC__) && defined(HAVE_SSE)
if((CPUCapFlags&CPU_CAP_SSE))
__asm__ __volatile__("ldmxcsr %0" : : "m" (*&ctl->sse_state));
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 743242d7..ca0df2ad 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -748,7 +748,11 @@ void *al_calloc(size_t alignment, size_t size);
void al_free(void *ptr);
typedef struct {
+#ifdef HAVE_FENV_H
+ DERIVE_FROM_TYPE(fenv_t);
+#else
int state;
+#endif
#ifdef HAVE_SSE
int sse_state;
#endif