aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alu.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-29 04:03:18 -0700
committerChris Robinson <[email protected]>2011-09-29 04:03:18 -0700
commitf4925a0e6a1988a4274ab1c8928ba88f70b6c39a (patch)
treec61285d90931c5202243cc2ced271462921f0434 /OpenAL32/Include/alu.h
parentb6b3ca6e6ffab6aa943c760be1290954190ae66e (diff)
Use inline functions to set/restore the FPU mode for mixer updates
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r--OpenAL32/Include/alu.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index e8ac64fd..6c09d32f 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -195,6 +195,30 @@ static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat
return a0*mu*mu2 + a1*mu2 + a2*mu + a3;
}
+
+static __inline int SetMixerFPUMode(void)
+{
+ int fpuState = 0;
+#if defined(HAVE_FESETROUND)
+ fpuState = fegetround();
+ fesetround(FE_TOWARDZERO);
+#elif defined(HAVE__CONTROLFP)
+ fpuState = _controlfp(0, 0);
+ (void)_controlfp(_RC_CHOP, _MCW_RC);
+#endif
+ return fpuState;
+}
+
+static __inline void RestoreFPUMode(int state)
+{
+#if defined(HAVE_FESETROUND)
+ fesetround(state);
+#elif defined(HAVE__CONTROLFP)
+ _controlfp(state, _MCW_RC);
+#endif
+}
+
+
ALvoid aluInitPanning(ALCdevice *Device);
ALint aluCart2LUTpos(ALfloat re, ALfloat im);