diff options
author | Chris Robinson <[email protected]> | 2020-12-31 18:20:05 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-12-31 18:23:59 -0800 |
commit | 87a862199d6e64e8be9909657288ffa66b1c40fb (patch) | |
tree | e9c567fb024024463588a4c9082192cace899498 /core/fpu_ctrl.cpp | |
parent | 20ef8bf390541339f068676f9d14061fe2f5e115 (diff) |
Make FPUCtl methods noexcept
Diffstat (limited to 'core/fpu_ctrl.cpp')
-rw-r--r-- | core/fpu_ctrl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/fpu_ctrl.cpp b/core/fpu_ctrl.cpp index 24021c7d..b12f2c96 100644 --- a/core/fpu_ctrl.cpp +++ b/core/fpu_ctrl.cpp @@ -13,11 +13,13 @@ #include "cpu_caps.h" -FPUCtl::FPUCtl() +void FPUCtl::enter() noexcept { + if(this->in_mode) return; + #if defined(HAVE_SSE_INTRINSICS) this->sse_state = _mm_getcsr(); - unsigned int sseState = this->sse_state; + unsigned int sseState{this->sse_state}; sseState |= 0x8000; /* set flush-to-zero */ sseState |= 0x0040; /* set denormals-are-zero */ _mm_setcsr(sseState); @@ -27,7 +29,7 @@ FPUCtl::FPUCtl() if((CPUCapFlags&CPU_CAP_SSE)) { __asm__ __volatile__("stmxcsr %0" : "=m" (*&this->sse_state)); - unsigned int sseState = this->sse_state; + unsigned int sseState{this->sse_state}; sseState |= 0x8000; /* set flush-to-zero */ if((CPUCapFlags&CPU_CAP_SSE2)) sseState |= 0x0040; /* set denormals-are-zero */ @@ -38,7 +40,7 @@ FPUCtl::FPUCtl() this->in_mode = true; } -void FPUCtl::leave() +void FPUCtl::leave() noexcept { if(!this->in_mode) return; |