Piotr Caban : ucrtbase: Store sse and x87 exception in fexcept_t.

Alexandre Julliard julliard at winehq.org
Thu May 13 15:31:00 CDT 2021


Module: wine
Branch: master
Commit: 90fd548d0ab00bcdd1ced37caa1d3cc5a682e366
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=90fd548d0ab00bcdd1ced37caa1d3cc5a682e366

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu May 13 18:46:41 2021 +0200

ucrtbase: Store sse and x87 exception in fexcept_t.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 3792a09e526..2e827dd32c6 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2369,10 +2369,13 @@ int CDECL fesetexceptflag(const fexcept_t *status, int excepts)
     fegetenv(&env);
 #if _MSVCR_VER>=140 && (defined(__i386__) || defined(__x86_64__))
     env._Fe_stat &= ~fenv_encode(excepts, excepts);
-    env._Fe_stat |= fenv_encode(*status & excepts, *status & excepts);
+    env._Fe_stat |= *status & fenv_encode(excepts, excepts);
+#elif _MSVCR_VER>=140
+    env._Fe_stat &= ~fenv_encode(0, excepts);
+    env._Fe_stat |= *status & fenv_encode(0, excepts);
 #else
     env._Fe_stat &= ~excepts;
-    env._Fe_stat |= (*status & excepts);
+    env._Fe_stat |= *status & excepts;
 #endif
     return fesetenv(&env);
 }
@@ -2418,7 +2421,15 @@ int CDECL feclearexcept(int flags)
  */
 int CDECL fegetexceptflag(fexcept_t *status, int excepts)
 {
+#if _MSVCR_VER>=140 && defined(__i386__)
+    unsigned int x87, sse;
+    _statusfp2(&x87, &sse);
+    *status = fenv_encode(x87 & excepts, sse & excepts);
+#elif _MSVCR_VER>=140
+    *status = fenv_encode(0, _statusfp() & excepts);
+#else
     *status = _statusfp() & excepts;
+#endif
     return 0;
 }
 #endif




More information about the wine-cvs mailing list