Piotr Caban : msvcrt: Implement lrintf using rintf function.
Alexandre Julliard
julliard at winehq.org
Mon May 10 15:44:05 CDT 2021
Module: wine
Branch: master
Commit: aa2248164c0492f0554c65b268de3a7b2a1ac616
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aa2248164c0492f0554c65b268de3a7b2a1ac616
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon May 10 20:11:54 2021 +0200
msvcrt: Implement lrintf using rintf function.
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 | 10 +++++++++-
dlls/msvcrt/unixlib.c | 13 -------------
dlls/msvcrt/unixlib.h | 1 -
include/config.h.in | 3 ---
6 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/configure b/configure
index 2b17a5b20c7..b4434b16a86 100755
--- a/configure
+++ b/configure
@@ -19642,7 +19642,6 @@ for ac_func in \
log1pf \
log2 \
log2f \
- lrintf \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/configure.ac b/configure.ac
index 7af593fa6fd..2cd25a5671b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2682,7 +2682,6 @@ AC_CHECK_FUNCS(\
log1pf \
log2 \
log2f \
- lrintf \
nearbyint \
nearbyintf \
nexttoward \
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index fd580d44a9d..22b2b0c71ed 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -4356,7 +4356,15 @@ __msvcrt_long CDECL lrint(double x)
*/
__msvcrt_long CDECL lrintf(float x)
{
- return unix_funcs->lrintf( x );
+ float f;
+
+ f = rintf(x);
+ if ((f < 0 && f != (float)(__msvcrt_long)f)
+ || (f >= 0 && f != (float)(__msvcrt_ulong)f)) {
+ *_errno() = EDOM;
+ return 0;
+ }
+ return f;
}
/*********************************************************************
diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c
index 0353859eec2..52410b0cc9c 100644
--- a/dlls/msvcrt/unixlib.c
+++ b/dlls/msvcrt/unixlib.c
@@ -555,18 +555,6 @@ static float CDECL unix_logbf( float x )
return logbf( x );
}
-/*********************************************************************
- * lrintf
- */
-static int CDECL unix_lrintf(float x)
-{
-#ifdef HAVE_LRINTF
- return lrintf(x);
-#else
- return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
-#endif
-}
-
/*********************************************************************
* modf
*/
@@ -882,7 +870,6 @@ static const struct unix_funcs funcs =
unix_log2f,
unix_logb,
unix_logbf,
- unix_lrintf,
unix_modf,
unix_modff,
unix_nearbyint,
diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h
index 83356b0125b..4a33940fd64 100644
--- a/dlls/msvcrt/unixlib.h
+++ b/dlls/msvcrt/unixlib.h
@@ -72,7 +72,6 @@ struct unix_funcs
float (CDECL *log2f)(float x);
double (CDECL *logb)(double x);
float (CDECL *logbf)(float x);
- int (CDECL *lrintf)(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 5dac8fd704c..920600dd680 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -471,9 +471,6 @@
/* Define to 1 if you have the `log2f' function. */
#undef HAVE_LOG2F
-/* Define to 1 if you have the `lrintf' function. */
-#undef HAVE_LRINTF
-
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
More information about the wine-cvs
mailing list