Move a loop into a function
[openal-soft.git] / Alc / fpu_modes.h
blob750252fc4c78d79cec5779b15e82bbe1942e30ac
1 #ifndef FPU_MODES_H
2 #define FPU_MODES_H
4 #ifdef HAVE_FENV_H
5 #include <fenv.h>
6 #endif
9 typedef struct FPUCtl {
10 #ifdef HAVE_FENV_H
11 fenv_t flt_env;
12 #ifdef _WIN32
13 int round_mode;
14 #endif
15 #else
16 int state;
17 #endif
18 #ifdef HAVE_SSE
19 int sse_state;
20 #endif
21 } FPUCtl;
22 void SetMixerFPUMode(FPUCtl *ctl);
23 void RestoreFPUMode(const FPUCtl *ctl);
25 #ifdef __GNUC__
26 /* Use an alternate macro set with GCC to avoid accidental continue or break
27 * statements within the mixer mode.
29 #define START_MIXER_MODE() __extension__({ FPUCtl _oldMode; SetMixerFPUMode(&_oldMode)
30 #define END_MIXER_MODE() RestoreFPUMode(&_oldMode); })
31 #else
32 #define START_MIXER_MODE() do { FPUCtl _oldMode; SetMixerFPUMode(&_oldMode)
33 #define END_MIXER_MODE() RestoreFPUMode(&_oldMode); } while(0)
34 #endif
35 #define LEAVE_MIXER_MODE() RestoreFPUMode(&_oldMode)
37 #endif /* FPU_MODES_H */