Piotr Caban : msvcrt: Import lroundf implementation from musl.
Alexandre Julliard
julliard at winehq.org
Thu Apr 29 16:38:32 CDT 2021
Module: wine
Branch: master
Commit: 7fa8b03cd3ff16664bd3bfb3286dff1346e5dc08
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7fa8b03cd3ff16664bd3bfb3286dff1346e5dc08
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Apr 29 17:06:35 2021 +0200
msvcrt: Import lroundf 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 690f9333f14..794a3e09c29 100755
--- a/configure
+++ b/configure
@@ -19642,7 +19642,6 @@ for ac_func in \
lrint \
lrintf \
lround \
- lroundf \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/configure.ac b/configure.ac
index b0977c112b4..3bfa2885002 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2685,7 +2685,6 @@ AC_CHECK_FUNCS(\
lrint \
lrintf \
lround \
- lroundf \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index c8dd53cf095..e1251ba7115 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4368,10 +4368,17 @@ __msvcrt_long CDECL lround(double x)
/*********************************************************************
* lroundf (MSVCR120.@)
+ *
+ * Copied from musl: src/math/lroundf.c
*/
__msvcrt_long CDECL lroundf(float x)
{
- return unix_funcs->lroundf( x );
+ float f = roundf(x);
+ if (f != (float)(__msvcrt_long)f) {
+ *_errno() = EDOM;
+ return 0;
+ }
+ return f;
}
/*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index e3ddd486e93..3bf99c09c24 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -777,18 +777,6 @@ static int CDECL unix_lround(double x)
#endif
}
-/*********************************************************************
- * lroundf
- */
-static int CDECL unix_lroundf(float x)
-{
-#ifdef HAVE_LROUNDF
- return lroundf(x);
-#else
- return unix_lround(x);
-#endif
-}
-
/*********************************************************************
* sin
*/
@@ -957,7 +945,6 @@ static const struct unix_funcs funcs =
unix_lrint,
unix_lrintf,
unix_lround,
- unix_lroundf,
unix_modf,
unix_modff,
unix_nearbyint,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index 49ec319d219..c74115bc76c 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -75,7 +75,6 @@ struct unix_funcs
int (CDECL *lrint)(double x);
int (CDECL *lrintf)(float x);
int (CDECL *lround)(double x);
- int (CDECL *lroundf)(float 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 71f9f4350b0..544fe85b248 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -480,9 +480,6 @@
/* Define to 1 if you have the `lround' function. */
#undef HAVE_LROUND
-/* Define to 1 if you have the `lroundf' function. */
-#undef HAVE_LROUNDF
-
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
More information about the wine-cvs
mailing list