Piotr Caban : msvcrt: Import lround implementation from musl.
Alexandre Julliard
julliard at winehq.org
Thu Apr 29 16:38:33 CDT 2021
Module: wine
Branch: master
Commit: 69ad3c11cfb00b518c78103525e3452502173195
URL: https://source.winehq.org/git/wine.git/?a=commit;h=69ad3c11cfb00b518c78103525e3452502173195
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Apr 29 17:06:38 2021 +0200
msvcrt: Import lround 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 794a3e09c29..2251a30af72 100755
--- a/configure
+++ b/configure
@@ -19641,7 +19641,6 @@ for ac_func in \
log2f \
lrint \
lrintf \
- lround \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/configure.ac b/configure.ac
index 3bfa2885002..20ec971b5bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2684,7 +2684,6 @@ AC_CHECK_FUNCS(\
log2f \
lrint \
lrintf \
- lround \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index e1251ba7115..018a8ae47e4 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4360,10 +4360,17 @@ float CDECL roundf(float x)
/*********************************************************************
* lround (MSVCR120.@)
+ *
+ * Copied from musl: src/math/lround.c
*/
__msvcrt_long CDECL lround(double x)
{
- return unix_funcs->lround( x );
+ double d = round(x);
+ if (d != (double)(__msvcrt_long)d) {
+ *_errno() = EDOM;
+ return 0;
+ }
+ return d;
}
/*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 3bf99c09c24..a7c7202c516 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -765,18 +765,6 @@ static double CDECL unix_round(double x)
#endif
}
-/*********************************************************************
- * lround
- */
-static int CDECL unix_lround(double x)
-{
-#ifdef HAVE_LROUND
- return lround(x);
-#else
- return unix_round(x);
-#endif
-}
-
/*********************************************************************
* sin
*/
@@ -944,7 +932,6 @@ static const struct unix_funcs funcs =
unix_logbf,
unix_lrint,
unix_lrintf,
- unix_lround,
unix_modf,
unix_modff,
unix_nearbyint,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index c74115bc76c..89972ed669f 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -74,7 +74,6 @@ struct unix_funcs
float (CDECL *logbf)(float x);
int (CDECL *lrint)(double x);
int (CDECL *lrintf)(float x);
- int (CDECL *lround)(double x);
double (CDECL *modf)(double x, double *iptr);
float (CDECL *modff)(float x, float *iptr);
double (CDECL *nearbyint)(double num);
diff --git a/include/config.h.in b/include/config.h.in
index 544fe85b248..387c8b718ff 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -477,9 +477,6 @@
/* Define to 1 if you have the `lrintf' function. */
#undef HAVE_LRINTF
-/* Define to 1 if you have the `lround' function. */
-#undef HAVE_LROUND
-
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
More information about the wine-cvs
mailing list