diff options
author | Chris Robinson <[email protected]> | 2017-07-13 22:30:39 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-07-13 22:30:39 -0700 |
commit | a535169bbdd6766cbc6b53188065fbee6d4da1bc (patch) | |
tree | 26fd1cf5cf1cd7220026a817180dd1f7583d751b /OpenAL32 | |
parent | 22d77b87a3f103eeceec004cd9d053c17bf1b883 (diff) |
Use macros to set and restore the mixer FPU mode
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 11 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 7 |
2 files changed, 14 insertions, 4 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 4081508e..ca97bff0 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -907,6 +907,17 @@ typedef struct { } 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; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index cd2c1e09..02288a31 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -506,7 +506,6 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e if(newtype != EffectSlot->Effect.Type) { ALeffectStateFactory *factory; - FPUCtl oldMode; factory = getFactoryByType(newtype); if(!factory) @@ -517,19 +516,19 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e State = V0(factory,create)(); if(!State) return AL_OUT_OF_MEMORY; - SetMixerFPUMode(&oldMode); + START_MIXER_MODE(); almtx_lock(&Device->BackendLock); State->OutBuffer = Device->Dry.Buffer; State->OutChannels = Device->Dry.NumChannels; if(V(State,deviceUpdate)(Device) == AL_FALSE) { almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + LEAVE_MIXER_MODE(); ALeffectState_DecRef(State); return AL_OUT_OF_MEMORY; } almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); if(!effect) { |