aboutsummaryrefslogtreecommitdiffstats
path: root/core/fpu_ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpu_ctrl.cpp')
-rw-r--r--core/fpu_ctrl.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/core/fpu_ctrl.cpp b/core/fpu_ctrl.cpp
index 435855ad..28e60c04 100644
--- a/core/fpu_ctrl.cpp
+++ b/core/fpu_ctrl.cpp
@@ -64,29 +64,24 @@ void reset_fpu(unsigned int state [[maybe_unused]])
} // namespace
-void FPUCtl::enter() noexcept
+unsigned int FPUCtl::Set() noexcept
{
- if(this->in_mode) return;
-
+ unsigned int state{};
#if defined(HAVE_SSE_INTRINSICS)
- disable_denormals(&this->sse_state);
+ disable_denormals(&state);
#elif defined(HAVE_SSE)
if((CPUCapFlags&CPU_CAP_SSE))
- disable_denormals(&this->sse_state);
+ disable_denormals(&state);
#endif
-
- this->in_mode = true;
+ return state;
}
-void FPUCtl::leave() noexcept
+void FPUCtl::Reset(unsigned int state [[maybe_unused]]) noexcept
{
- if(!this->in_mode) return;
-
#if defined(HAVE_SSE_INTRINSICS)
- reset_fpu(this->sse_state);
+ reset_fpu(state);
#elif defined(HAVE_SSE)
if((CPUCapFlags&CPU_CAP_SSE))
- reset_fpu(this->sse_state);
+ reset_fpu(state);
#endif
- this->in_mode = false;
}