Piotr Caban : msvcrt: Import neabyintf implementation from musl.
Alexandre Julliard
julliard at winehq.org
Fri May 14 15:47:05 CDT 2021
Module: wine
Branch: master
Commit: 2caca437332b95ec807dd6195ac4bd4df616f934
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2caca437332b95ec807dd6195ac4bd4df616f934
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri May 14 16:11:44 2021 +0200
msvcrt: Import neabyintf 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 | 13 +++++++++++--
dlls/msvcrt/unixlib.c | 13 -------------
dlls/msvcrt/unixlib.h | 1 -
include/config.h.in | 3 ---
6 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/configure b/configure
index b6964befcc5..91f0c586c60 100755
--- a/configure
+++ b/configure
@@ -19641,7 +19641,6 @@ for ac_func in \
log2 \
log2f \
nearbyint \
- nearbyintf \
nexttoward \
nexttowardf \
remainder \
diff --git a/configure.ac b/configure.ac
index 2e809c2e1f0..df1025aeb98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2681,7 +2681,6 @@ AC_CHECK_FUNCS(\
log2 \
log2f \
nearbyint \
- nearbyintf \
nexttoward \
nexttowardf \
remainder \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 2e827dd32c6..7fe7b9d172b 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -3426,10 +3426,19 @@ double CDECL nearbyint(double num)
/*********************************************************************
* _nearbyintf (MSVCR120.@)
+ *
+ * Based on musl: src/math/nearbyteintf.c
*/
-float CDECL nearbyintf(float num)
+float CDECL nearbyintf(float x)
{
- return unix_funcs->nearbyintf( num );
+ fenv_t env;
+
+ fegetenv(&env);
+ _control87(_MCW_EM, _MCW_EM);
+ x = rintf(x);
+ feclearexcept(FE_INEXACT);
+ feupdateenv(&env);
+ return x;
}
/*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 282c11166f5..a0892e98d97 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -559,18 +559,6 @@ static double CDECL unix_nearbyint(double num)
#endif
}
-/*********************************************************************
- * nearbyintf
- */
-static float CDECL unix_nearbyintf(float num)
-{
-#ifdef HAVE_NEARBYINTF
- return nearbyintf(num);
-#else
- return unix_nearbyint(num);
-#endif
-}
-
/*********************************************************************
* nextafter
*/
@@ -847,7 +835,6 @@ static const struct unix_funcs funcs =
unix_modf,
unix_modff,
unix_nearbyint,
- unix_nearbyintf,
unix_nextafter,
unix_nextafterf,
unix_nexttoward,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index 6ce85c194ac..d8b5e6b3f24 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -73,7 +73,6 @@ struct unix_funcs
double (CDECL *modf)(double x, double *iptr);
float (CDECL *modff)(float x, float *iptr);
double (CDECL *nearbyint)(double num);
- float (CDECL *nearbyintf)(float num);
double (CDECL *nextafter)(double x, double y);
float (CDECL *nextafterf)(float x, float y);
double (CDECL *nexttoward)(double x, double y);
diff --git a/include/config.h.in b/include/config.h.in
index 2fc36aa7eda..896d44cd71e 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -504,9 +504,6 @@
/* Define to 1 if you have the `nearbyint' function. */
#undef HAVE_NEARBYINT
-/* Define to 1 if you have the `nearbyintf' function. */
-#undef HAVE_NEARBYINTF
-
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
More information about the wine-cvs
mailing list