2020-03-20 15:01:45 -07:00
|
|
|
#ifndef FPU_CTRL_H
|
|
|
|
#define FPU_CTRL_H
|
2018-01-11 08:44:52 -08:00
|
|
|
|
2018-11-21 09:07:02 -08:00
|
|
|
class FPUCtl {
|
2019-03-18 20:14:40 -07:00
|
|
|
#if defined(HAVE_SSE_INTRINSICS) || (defined(__GNUC__) && defined(HAVE_SSE))
|
2018-11-21 09:07:02 -08:00
|
|
|
unsigned int sse_state{};
|
2018-01-11 08:44:52 -08:00
|
|
|
#endif
|
2018-11-21 09:07:02 -08:00
|
|
|
bool in_mode{};
|
2018-01-11 08:44:52 -08:00
|
|
|
|
2018-11-21 09:07:02 -08:00
|
|
|
public:
|
2019-04-26 07:11:09 -07:00
|
|
|
FPUCtl();
|
|
|
|
/* HACK: 32-bit targets for GCC seem to have a problem here with certain
|
|
|
|
* noexcept methods (which destructors are) causing an internal compiler
|
|
|
|
* error. No idea why it's these methods specifically, but this is needed
|
|
|
|
* to get it to compile.
|
|
|
|
*/
|
|
|
|
~FPUCtl() noexcept(false) { leave(); }
|
2018-01-11 08:44:52 -08:00
|
|
|
|
2018-11-21 09:07:02 -08:00
|
|
|
FPUCtl(const FPUCtl&) = delete;
|
|
|
|
FPUCtl& operator=(const FPUCtl&) = delete;
|
|
|
|
|
2019-04-26 07:11:09 -07:00
|
|
|
void leave();
|
2018-11-21 09:07:02 -08:00
|
|
|
};
|
2018-11-11 14:56:25 -08:00
|
|
|
|
2020-03-20 15:01:45 -07:00
|
|
|
#endif /* FPU_CTRL_H */
|