Alexandre Julliard : msvcrt: Reimplement _chgsign().

Alexandre Julliard julliard at winehq.org
Mon Nov 16 15:28:57 CST 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov 16 15:04:00 2020 +0100

msvcrt: Reimplement _chgsign().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 6ed8a50330d..8e8324b8fbe 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -170,8 +170,9 @@ int CDECL MSVCRT__set_FMA3_enable(int flag)
  */
 float CDECL MSVCRT__chgsignf( float num )
 {
-    /* FIXME: +-infinity,Nan not tested */
-    return -num;
+    union { float f; UINT32 i; } u = { num };
+    u.i ^= 0x80000000;
+    return u.f;
 }
 
 /*********************************************************************
@@ -1786,8 +1787,9 @@ double CDECL MSVCRT__cabs(struct MSVCRT__complex num)
  */
 double CDECL MSVCRT__chgsign(double num)
 {
-  /* FIXME: +-infinity,Nan not tested */
-  return -num;
+    union { double f; UINT64 i; } u = { num };
+    u.i ^= 1ull << 63;
+    return u.f;
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list