From a859639cfe18047a326785379fa2583d75a85bac Mon Sep 17 00:00:00 2001
From: Pierre Raybaut
Date: Tue, 1 Oct 2024 14:28:31 +0200
Subject: [PATCH] Fix scaler engine performance regression on Windows:
compiling with `/fp:fast` option
Fix Windows: Image `_scaler` engine performance regression #23
(cherry picked from commit db88b7041f334b5bf6df4ad3eb0b98e52a861b07)
(cherry picked from commit ec6c8c4dc47455490e7f4a951afcb35cee9f55f1)
---
setup.py | 2 +-
src/pcolor.cpp | 1 -
src/scaler.cpp | 1 -
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index ea0d0a6f..e3c5bb80 100644
--- a/setup.py
+++ b/setup.py
@@ -50,7 +50,7 @@ def compile_cython_extensions():
# -------------------------------------------------------------------------------------
MACROS_CPP = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
-CFLAGS_CPP = ["/EHsc"] if is_msvc() else ["-Wall"]
+CFLAGS_CPP = ["/EHsc", "/fp:fast"] if is_msvc() else ["-Wall"]
if platform.system() == "Darwin":
CFLAGS_CPP += ["-std=c++11"]
diff --git a/src/pcolor.cpp b/src/pcolor.cpp
index 1db14a4d..f85dac60 100644
--- a/src/pcolor.cpp
+++ b/src/pcolor.cpp
@@ -9,7 +9,6 @@
#include
#ifdef _MSC_VER
#include
-#pragma fenv_access(on)
#else
#include
#endif
diff --git a/src/scaler.cpp b/src/scaler.cpp
index 10e56445..c7d04e8d 100644
--- a/src/scaler.cpp
+++ b/src/scaler.cpp
@@ -9,7 +9,6 @@
#include
#ifdef _MSC_VER
#include
-#pragma fenv_access(on)
#define FE_TOWARDZERO _RC_CHOP
#define fegetround() (_controlfp(0, 0) & _MCW_RC)
int fesetround(int r)