diff options
author | Chris Robinson <[email protected]> | 2011-09-29 05:10:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-29 05:10:15 -0700 |
commit | d3a6de3f867fc617190de317c26ed599e9e2c88d (patch) | |
tree | e43568584b218fbcee571dc6b6a01bc033045af4 /OpenAL32/Include/alu.h | |
parent | f4925a0e6a1988a4274ab1c8928ba88f70b6c39a (diff) |
Set the FPU into single-precision mode for mixer updates
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r-- | OpenAL32/Include/alu.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 6c09d32f..bd00e86d 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -198,23 +198,35 @@ static __inline ALfloat cubic(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat static __inline int SetMixerFPUMode(void) { - int fpuState = 0; -#if defined(HAVE_FESETROUND) +#if defined(_FPU_GETCW) && defined(_FPU_SETCW) + 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(); fesetround(FE_TOWARDZERO); -#elif defined(HAVE__CONTROLFP) - fpuState = _controlfp(0, 0); - (void)_controlfp(_RC_CHOP, _MCW_RC); +#endif #endif return fpuState; } static __inline void RestoreFPUMode(int state) { -#if defined(HAVE_FESETROUND) - fesetround(state); +#if defined(_FPU_GETCW) && defined(_FPU_SETCW) + fpu_control_t fpuState = state; + _FPU_SETCW(fpuState); #elif defined(HAVE__CONTROLFP) - _controlfp(state, _MCW_RC); + _controlfp(state, _MCW_RC|_MCW_PC); +#elif defined(HAVE_FESETROUND) + fesetround(state); #endif } |