Move the FPU mode declarations to a separate header
Also don't use inheritance with FPUCtl.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "alu.h"
|
||||
#include "alconfig.h"
|
||||
|
||||
#include "fpu_modes.h"
|
||||
#include "cpu_caps.h"
|
||||
#include "compat.h"
|
||||
#include "threads.h"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "bformatdec.h"
|
||||
#include "static_assert.h"
|
||||
|
||||
#include "fpu_modes.h"
|
||||
#include "cpu_caps.h"
|
||||
#include "mixer_defs.h"
|
||||
#include "bsinc_inc.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "converter.h"
|
||||
|
||||
#include "fpu_modes.h"
|
||||
#include "mixer_defs.h"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef FPU_MODES_H
|
||||
#define FPU_MODES_H
|
||||
|
||||
#ifdef HAVE_FENV_H
|
||||
#include <fenv.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct FPUCtl {
|
||||
#ifdef HAVE_FENV_H
|
||||
fenv_t flt_env;
|
||||
#ifdef _WIN32
|
||||
int round_mode;
|
||||
#endif
|
||||
#else
|
||||
int state;
|
||||
#endif
|
||||
#ifdef HAVE_SSE
|
||||
int sse_state;
|
||||
#endif
|
||||
} 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)
|
||||
|
||||
#endif /* FPU_MODES_H */
|
||||
+3
-2
@@ -109,6 +109,7 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x
|
||||
#include "alMain.h"
|
||||
#include "alu.h"
|
||||
#include "cpu_caps.h"
|
||||
#include "fpu_modes.h"
|
||||
#include "atomic.h"
|
||||
#include "uintmap.h"
|
||||
#include "vector.h"
|
||||
@@ -295,7 +296,7 @@ void FillCPUCaps(int capfilter)
|
||||
void SetMixerFPUMode(FPUCtl *ctl)
|
||||
{
|
||||
#ifdef HAVE_FENV_H
|
||||
fegetenv(STATIC_CAST(fenv_t, ctl));
|
||||
fegetenv(&ctl->flt_env);
|
||||
#ifdef _WIN32
|
||||
/* HACK: A nasty bug in MinGW-W64 causes fegetenv and fesetenv to not save
|
||||
* and restore the FPU rounding mode, so we have to do it manually. Don't
|
||||
@@ -348,7 +349,7 @@ void SetMixerFPUMode(FPUCtl *ctl)
|
||||
void RestoreFPUMode(const FPUCtl *ctl)
|
||||
{
|
||||
#ifdef HAVE_FENV_H
|
||||
fesetenv(STATIC_CAST(fenv_t, ctl));
|
||||
fesetenv(&ctl->flt_env);
|
||||
#ifdef _WIN32
|
||||
fesetround(ctl->round_mode);
|
||||
#endif
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FENV_H
|
||||
#include <fenv.h>
|
||||
#endif
|
||||
|
||||
#include "AL/al.h"
|
||||
#include "AL/alc.h"
|
||||
#include "AL/alext.h"
|
||||
@@ -803,34 +799,6 @@ void ALCcontext_DeferUpdates(ALCcontext *context);
|
||||
void ALCcontext_ProcessUpdates(ALCcontext *context);
|
||||
|
||||
|
||||
typedef struct {
|
||||
#ifdef HAVE_FENV_H
|
||||
DERIVE_FROM_TYPE(fenv_t);
|
||||
#ifdef _WIN32
|
||||
int round_mode;
|
||||
#endif
|
||||
#else
|
||||
int state;
|
||||
#endif
|
||||
#ifdef HAVE_SSE
|
||||
int sse_state;
|
||||
#endif
|
||||
} 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;
|
||||
typedef struct ll_ringbuffer_data {
|
||||
char *buf;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "alListener.h"
|
||||
#include "alSource.h"
|
||||
|
||||
#include "fpu_modes.h"
|
||||
#include "almalloc.h"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user