aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-16 01:44:45 -0700
committerChris Robinson <[email protected]>2012-09-16 01:44:45 -0700
commita1daec66e29cf90132d4a5e51e00b04a162f15be (patch)
tree8f6dc98a0e1100d7bdd18fc7c663c251b418f143
parent657ee85136861c9da105a67050ae84a85ecfe808 (diff)
Use __control87_2 when available
-rw-r--r--Alc/helpers.c7
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.in3
3 files changed, 11 insertions, 0 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 5acf2be2..625c9c96 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -185,6 +185,10 @@ void SetMixerFPUMode(FPUCtl *ctl)
if((CPUCapFlags&CPU_CAP_SSE))
newState |= 0x8000; /* flush-to-zero */
_FPU_SETCW(newState);
+#elif defined(HAVE___CONTROL87_2)
+ int mode;
+ __control87_2(0, 0, &ctl->state, NULL);
+ __control87_2(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC, &mode, NULL);
#elif defined(HAVE__CONTROLFP)
ctl->state = _controlfp(0, 0);
(void)_controlfp(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC);
@@ -201,6 +205,9 @@ void RestoreFPUMode(const FPUCtl *ctl)
#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
fpu_control_t fpuState = ctl->state;
_FPU_SETCW(fpuState);
+#elif defined(HAVE___CONTROL87_2)
+ int mode;
+ __control87_2(ctl->state, _MCW_RC|_MCW_DN|_MCW_PC, &mode, NULL);
#elif defined(HAVE__CONTROLFP)
_controlfp(ctl->state, _MCW_RC|_MCW_DN|_MCW_PC);
#elif defined(HAVE_FESETROUND)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64656c45..88e2a38c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,6 +277,7 @@ IF(HAVE_FENV_H)
ENDIF()
IF(HAVE_FLOAT_H)
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
+ CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
ENDIF()
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
diff --git a/config.h.in b/config.h.in
index b0729b09..3f426994 100644
--- a/config.h.in
+++ b/config.h.in
@@ -157,6 +157,9 @@
/* Define if we have _controlfp() */
#cmakedefine HAVE__CONTROLFP
+/* Define if we have __control87_2() */
+#cmakedefine HAVE___CONTROL87_2
+
/* Define if we have pthread_setschedparam() */
#cmakedefine HAVE_PTHREAD_SETSCHEDPARAM