aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c10
-rw-r--r--Alc/ALu.c6
-rw-r--r--Alc/helpers.c21
-rw-r--r--OpenAL32/Include/alMain.h7
-rw-r--r--OpenAL32/alAuxEffectSlot.c8
-rw-r--r--OpenAL32/alState.c6
6 files changed, 29 insertions, 29 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 556bf111..7b18481c 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1399,7 +1399,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
enum DevFmtChannels oldChans;
enum DevFmtType oldType;
ALCuint oldFreq;
- int oldMode;
+ FPUCtl oldMode;
ALuint i;
// Check for attributes
@@ -1630,7 +1630,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
WARN("SSE performs best with multiple of 4 update sizes (%u)\n", device->UpdateSize);
}
- oldMode = SetMixerFPUMode();
+ SetMixerFPUMode(&oldMode);
ALCdevice_Lock(device);
context = device->ContextList;
while(context)
@@ -1647,7 +1647,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
UnlockUIntMapRead(&context->EffectSlotMap);
ALCdevice_Unlock(device);
- RestoreFPUMode(oldMode);
+ RestoreFPUMode(&oldMode);
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
@@ -1683,14 +1683,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE)
{
ALCdevice_Unlock(device);
- RestoreFPUMode(oldMode);
+ RestoreFPUMode(&oldMode);
return ALC_INVALID_DEVICE;
}
slot->NeedsUpdate = AL_FALSE;
ALeffectState_Update(slot->EffectState, device, slot);
}
ALCdevice_Unlock(device);
- RestoreFPUMode(oldMode);
+ RestoreFPUMode(&oldMode);
if(ALCdevice_StartPlayback(device) == ALC_FALSE)
return ALC_INVALID_DEVICE;
diff --git a/Alc/ALu.c b/Alc/ALu.c
index b94216ff..3033e7ce 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -905,10 +905,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
ALeffectslot **slot, **slot_end;
ALsource **src, **src_end;
ALCcontext *ctx;
- int fpuState;
+ FPUCtl oldMode;
ALuint i, c;
- fpuState = SetMixerFPUMode();
+ SetMixerFPUMode(&oldMode);
while(size > 0)
{
@@ -1082,7 +1082,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
size -= SamplesToDo;
}
- RestoreFPUMode(fpuState);
+ RestoreFPUMode(&oldMode);
}
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 9529acec..5acf2be2 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -173,41 +173,38 @@ void al_free(void *ptr)
}
-int SetMixerFPUMode(void)
+void SetMixerFPUMode(FPUCtl *ctl)
{
#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
fpu_control_t fpuState, newState;
_FPU_GETCW(fpuState);
+ ctl->state = 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;
if((CPUCapFlags&CPU_CAP_SSE))
newState |= 0x8000; /* flush-to-zero */
_FPU_SETCW(newState);
-#else
- int fpuState;
-#if defined(HAVE__CONTROLFP)
- fpuState = _controlfp(0, 0);
+#elif defined(HAVE__CONTROLFP)
+ ctl->state = _controlfp(0, 0);
(void)_controlfp(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC);
#elif defined(HAVE_FESETROUND)
- fpuState = fegetround();
+ ctl->state = fegetround();
#ifdef FE_TOWARDZERO
fesetround(FE_TOWARDZERO);
#endif
#endif
-#endif
- return fpuState;
}
-void RestoreFPUMode(int state)
+void RestoreFPUMode(const FPUCtl *ctl)
{
#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
- fpu_control_t fpuState = state;
+ fpu_control_t fpuState = ctl->state;
_FPU_SETCW(fpuState);
#elif defined(HAVE__CONTROLFP)
- _controlfp(state, _MCW_RC|_MCW_DN|_MCW_PC);
+ _controlfp(ctl->state, _MCW_RC|_MCW_DN|_MCW_PC);
#elif defined(HAVE_FESETROUND)
- fesetround(state);
+ fesetround(ctl->state);
#endif
}
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index af71a615..fd372326 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -778,8 +778,11 @@ void *al_malloc(size_t alignment, size_t size);
void *al_calloc(size_t alignment, size_t size);
void al_free(void *ptr);
-int SetMixerFPUMode(void);
-void RestoreFPUMode(int state);
+typedef struct {
+ int state;
+} FPUCtl;
+void SetMixerFPUMode(FPUCtl *ctl);
+void RestoreFPUMode(const FPUCtl *ctl);
ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
ALuint StopThread(ALvoid *thread);
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 048248aa..e3a626a1 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -528,12 +528,12 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
if(State)
{
- int oldMode;
- oldMode = SetMixerFPUMode();
+ FPUCtl oldMode;
+ SetMixerFPUMode(&oldMode);
if(ALeffectState_DeviceUpdate(State, Device) == AL_FALSE)
{
- RestoreFPUMode(oldMode);
+ RestoreFPUMode(&oldMode);
ALCdevice_Unlock(Device);
ALeffectState_Destroy(State);
return AL_OUT_OF_MEMORY;
@@ -551,7 +551,7 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e
ALeffectState_Update(EffectSlot->EffectState, Device, EffectSlot);
ALCdevice_Unlock(Device);
- RestoreFPUMode(oldMode);
+ RestoreFPUMode(&oldMode);
ALeffectState_Destroy(State);
State = NULL;
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 359885c5..678e9e94 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -597,9 +597,9 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
ALboolean UpdateSources;
ALsource **src, **src_end;
ALeffectslot **slot, **slot_end;
- int fpuState;
+ FPUCtl oldMode;
- fpuState = SetMixerFPUMode();
+ SetMixerFPUMode(&oldMode);
LockContext(Context);
Context->DeferUpdates = AL_TRUE;
@@ -634,7 +634,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
}
UnlockContext(Context);
- RestoreFPUMode(fpuState);
+ RestoreFPUMode(&oldMode);
}
ALCcontext_DecRef(Context);