Browse Source

Fix system::resetFpuFlags() build and crash on x64.

tags/v2.5.0
Andrew Belt 9 months ago
parent
commit
bd51869632
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/system.cpp

+ 5
- 1
src/system.cpp View File

@@ -31,6 +31,8 @@
#include <dbghelp.h>
#endif

#include <simd/common.hpp> // for _mm_getcsr etc

#include <archive.h>
#include <archive_entry.h>
#if defined ARCH_MAC
@@ -971,7 +973,7 @@ void setFpuFlags(uint32_t flags) {
}

void resetFpuFlags() {
uint32_t flags = 0;
uint32_t flags = getFpuFlags();

#if defined ARCH_X64
// Set CPU to flush-to-zero (FTZ) and denormals-are-zero (DAZ) mode
@@ -981,11 +983,13 @@ void resetFpuFlags() {
// _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
flags |= 0x0040;
// Round-to-nearest is default
flags &= ~0x6000;
#elif defined ARCH_ARM64
// Set Flush-to-Zero
flags |= 1 << 24;
// ARM64 always uses DAZ
// Round-to-nearest is default
flags &= ~((1 << 22) | (1 << 23));
#endif

setFpuFlags(flags);


Loading…
Cancel
Save