Piotr Caban : msvcrt: Import llroundf implementation from musl.

Alexandre Julliard julliard at winehq.org
Thu Apr 29 16:38:32 CDT 2021


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Apr 29 17:06:30 2021 +0200

msvcrt: Import llroundf 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    |  9 ++++++++-
 dlls/msvcrt/unixlib.c | 13 -------------
 dlls/msvcrt/unixlib.h |  1 -
 include/config.h.in   |  3 ---
 6 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/configure b/configure
index 1ff743f0328..61ff110a9d4 100755
--- a/configure
+++ b/configure
@@ -19636,7 +19636,6 @@ for ac_func in \
 	llrint \
 	llrintf \
 	llround \
-	llroundf \
 	log1p \
 	log1pf \
 	log2 \
diff --git a/configure.ac b/configure.ac
index 8ce76f1d645..a8842bcb52a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2679,7 +2679,6 @@ AC_CHECK_FUNCS(\
 	llrint \
 	llrintf \
 	llround \
-	llroundf \
 	log1p \
 	log1pf \
 	log2 \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 586f8950e0a..e5c2ed66d2b 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4384,10 +4384,17 @@ __int64 CDECL llround(double x)
 
 /*********************************************************************
  *      llroundf (MSVCR120.@)
+ *
+ * Copied from musl: src/math/llroundf.c
  */
 __int64 CDECL llroundf(float x)
 {
-    return unix_funcs->llroundf( x );
+    float f = roundf(x);
+    if (f != (float)(__int64)f) {
+        *_errno() = EDOM;
+        return 0;
+    }
+    return f;
 }
 
 /*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 456cb3de574..e23456e8250 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -801,18 +801,6 @@ static __int64 CDECL unix_llround(double x)
 #endif
 }
 
-/*********************************************************************
- *      llroundf
- */
-static __int64 CDECL unix_llroundf(float x)
-{
-#ifdef HAVE_LLROUNDF
-    return llroundf(x);
-#else
-    return unix_llround(x);
-#endif
-}
-
 /*********************************************************************
  *      sin
  */
@@ -969,7 +957,6 @@ static const struct unix_funcs funcs =
     unix_llrint,
     unix_llrintf,
     unix_llround,
-    unix_llroundf,
     unix_log,
     unix_logf,
     unix_log10,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index 2841a28f478..db090a9a2aa 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -63,7 +63,6 @@ struct unix_funcs
     __int64         (CDECL *llrint)(double x);
     __int64         (CDECL *llrintf)(float x);
     __int64         (CDECL *llround)(double x);
-    __int64         (CDECL *llroundf)(float x);
     double          (CDECL *log)(double x);
     float           (CDECL *logf)(float x);
     double          (CDECL *log10)(double x);
diff --git a/include/config.h.in b/include/config.h.in
index 749b79e1092..25c4e3f42ec 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -462,9 +462,6 @@
 /* Define to 1 if you have the `llround' function. */
 #undef HAVE_LLROUND
 
-/* Define to 1 if you have the `llroundf' function. */
-#undef HAVE_LLROUNDF
-
 /* Define to 1 if you have the `log1p' function. */
 #undef HAVE_LOG1P
 




More information about the wine-cvs mailing list