Module: wine Branch: master Commit: 0cdc52c65cadd0e17153856e6026e8cfc9bec985 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0cdc52c65cadd0e17153856e6...
Author: Piotr Caban piotr@codeweavers.com Date: Mon May 10 20:12:05 2021 +0200
msvcrt: Implement llrintf using rintf function.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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 d4f1cf1383c..b6964befcc5 100755 --- a/configure +++ b/configure @@ -19636,7 +19636,6 @@ for ac_func in \ fmaf \ lgamma \ lgammaf \ - llrintf \ log1p \ log1pf \ log2 \ diff --git a/configure.ac b/configure.ac index 8fa4eac0961..2e809c2e1f0 100644 --- a/configure.ac +++ b/configure.ac @@ -2676,7 +2676,6 @@ AC_CHECK_FUNCS(\ fmaf \ lgamma \ lgammaf \ - llrintf \ log1p \ log1pf \ log2 \ diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index b9209e7b349..e5c50efcf20 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -4388,7 +4388,15 @@ __int64 CDECL llrint(double x) */ __int64 CDECL llrintf(float x) { - return unix_funcs->llrintf( x ); + float f; + + f = rintf(x); + if ((f < 0 && f != (float)(__int64)f) + || (f >= 0 && f != (float)(unsigned __int64)f)) { + *_errno() = EDOM; + return 0; + } + return f; }
/********************************************************************* diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index a7a69405877..282c11166f5 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -435,18 +435,6 @@ static float CDECL unix_lgammaf(float x) #endif }
-/********************************************************************* - * llrintf - */ -static __int64 CDECL unix_llrintf(float x) -{ -#ifdef HAVE_LLRINTF - return llrintf(x); -#else - return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5); -#endif -} - /********************************************************************* * log */ @@ -846,7 +834,6 @@ static const struct unix_funcs funcs = unix_ldexp, unix_lgamma, unix_lgammaf, - unix_llrintf, unix_log, unix_logf, unix_log10, diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index 56e8d630dc2..6ce85c194ac 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -60,7 +60,6 @@ struct unix_funcs double (CDECL *ldexp)(double x, int exp); double (CDECL *lgamma)(double x); float (CDECL *lgammaf)(float x); - __int64 (CDECL *llrintf)(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 db5dba7a54f..2fc36aa7eda 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -453,9 +453,6 @@ /* Define to 1 if you have the <linux/videodev2.h> header file. */ #undef HAVE_LINUX_VIDEODEV2_H
-/* Define to 1 if you have the `llrintf' function. */ -#undef HAVE_LLRINTF - /* Define to 1 if you have the `log1p' function. */ #undef HAVE_LOG1P