Piotr Caban : msvcr120: Don't modify fenv_t members in math functions.

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


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

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

msvcr120: Don't modify fenv_t members in math functions.

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

---

 dlls/msvcrt/math.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index c2b9bc9675d..78d5580a0ec 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4750,12 +4750,8 @@ double CDECL acosh(double x)
 {
     if (x < 1)
     {
-        fenv_t env;
-
         *_errno() = EDOM;
-        fegetenv(&env);
-        env._Fe_stat |= FE_INVALID;
-        fesetenv(&env);
+        feraiseexcept(FE_INVALID);
         return NAN;
     }
     return unix_funcs->acosh( x );
@@ -4768,12 +4764,8 @@ float CDECL acoshf(float x)
 {
     if (x < 1)
     {
-        fenv_t env;
-
         *_errno() = EDOM;
-        fegetenv(&env);
-        env._Fe_stat |= FE_INVALID;
-        fesetenv(&env);
+        feraiseexcept(FE_INVALID);
         return NAN;
     }
     return unix_funcs->acoshf( x );
@@ -4787,14 +4779,9 @@ double CDECL atanh(double x)
     double ret;
 
     if (x > 1 || x < -1) {
-        fenv_t env;
-
         *_errno() = EDOM;
-
         /* on Linux atanh returns -NAN in this case */
-        fegetenv(&env);
-        env._Fe_stat |= FE_INVALID;
-        fesetenv(&env);
+        feraiseexcept(FE_INVALID);
         return NAN;
     }
     ret = unix_funcs->atanh( x );
@@ -4811,13 +4798,8 @@ float CDECL atanhf(float x)
     float ret;
 
     if (x > 1 || x < -1) {
-        fenv_t env;
-
         *_errno() = EDOM;
-
-        fegetenv(&env);
-        env._Fe_stat |= FE_INVALID;
-        fesetenv(&env);
+        feraiseexcept(FE_INVALID);
         return NAN;
     }
 




More information about the wine-cvs mailing list