Piotr Caban : msvcrt: Import remainderf implementation from musl.

Alexandre Julliard julliard at winehq.org
Wed May 19 14:55:13 CDT 2021


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed May 19 15:26:21 2021 +0200

msvcrt: Import remainderf implementation from musl.

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

---

 configure             |  1 -
 configure.ac          |  1 -
 dlls/msvcrt/math.c    | 11 +++++++----
 dlls/msvcrt/unixlib.c | 14 --------------
 dlls/msvcrt/unixlib.h |  1 -
 include/config.h.in   |  3 ---
 6 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 827d17d7500..44077d727fe 100755
--- a/configure
+++ b/configure
@@ -19638,7 +19638,6 @@ for ac_func in \
 	log1pf \
 	log2 \
 	log2f \
-	remainderf \
 	tgamma \
 	tgammaf
 
diff --git a/configure.ac b/configure.ac
index 8b319923816..56a4a75ac08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2678,7 +2678,6 @@ AC_CHECK_FUNCS(\
 	log1pf \
 	log2 \
 	log2f \
-	remainderf \
 	tgamma \
 	tgammaf
 )
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 6c856700f94..8ac545ae758 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -5488,13 +5488,16 @@ double CDECL remainder(double x, double y)
 
 /*********************************************************************
  *      remainderf (MSVCR120.@)
+ *
+ * Copied from musl: src/math/remainderf.c
  */
 float CDECL remainderf(float x, float y)
 {
-    /* this matches 64-bit Windows.  32-bit Windows is slightly different */
-    if(!isfinite(x)) *_errno() = EDOM;
-    if(isnan(y) || y==0.0f) *_errno() = EDOM;
-    return unix_funcs->remainderf( x, y );
+    int q;
+#if _MSVCR_VER == 120 && defined(__x86_64__)
+    if (isnan(x) || isnan(y)) *_errno() = EDOM;
+#endif
+    return remquof(x, y, &q);
 }
 
 /*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index b1f824f4c72..da253d9b55c 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -475,19 +475,6 @@ static float CDECL unix_powf( float x, float y )
     return powf( x, y );
 }
 
-/*********************************************************************
- *      remainderf
- */
-static float CDECL unix_remainderf(float x, float y)
-{
-#ifdef HAVE_REMAINDERF
-    return remainderf(x, y);
-#else
-    FIXME( "not implemented\n" );
-    return 0;
-#endif
-}
-
 /*********************************************************************
  *      sin
  */
@@ -621,7 +608,6 @@ static const struct unix_funcs funcs =
     unix_logbf,
     unix_pow,
     unix_powf,
-    unix_remainderf,
     unix_sin,
     unix_sinf,
     unix_sinh,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index d301a9716cf..84e62fd133a 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -64,7 +64,6 @@ struct unix_funcs
     float           (CDECL *logbf)(float x);
     double          (CDECL *pow)(double x, double y);
     float           (CDECL *powf)(float x, float y);
-    float           (CDECL *remainderf)(float x, float y);
     double          (CDECL *sin)(double x);
     float           (CDECL *sinf)(float x);
     double          (CDECL *sinh)(double x);
diff --git a/include/config.h.in b/include/config.h.in
index 58325f3df92..72e981821da 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -630,9 +630,6 @@
 /* Define to 1 if you have the `readlink' function. */
 #undef HAVE_READLINK
 
-/* Define to 1 if you have the `remainderf' function. */
-#undef HAVE_REMAINDERF
-
 /* Define to 1 if the system has the type `request_sense'. */
 #undef HAVE_REQUEST_SENSE
 




More information about the wine-cvs mailing list