msvcrt: Implement llrint using rint function.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-05-10 20:11:59 +02:00 committed by Alexandre Julliard
parent aa2248164c
commit 45586c5703
6 changed files with 9 additions and 20 deletions

1
configure vendored
View File

@ -19636,7 +19636,6 @@ for ac_func in \
fmaf \
lgamma \
lgammaf \
llrint \
llrintf \
log1p \
log1pf \

View File

@ -2676,7 +2676,6 @@ AC_CHECK_FUNCS(\
fmaf \
lgamma \
lgammaf \
llrint \
llrintf \
log1p \
log1pf \

View File

@ -4372,7 +4372,15 @@ __msvcrt_long CDECL lrintf(float x)
*/
__int64 CDECL llrint(double x)
{
return unix_funcs->llrint( x );
double d;
d = rint(x);
if ((d < 0 && d != (double)(__int64)d)
|| (d >= 0 && d != (double)(unsigned __int64)d)) {
*_errno() = EDOM;
return 0;
}
return d;
}
/*********************************************************************

View File

@ -435,18 +435,6 @@ static float CDECL unix_lgammaf(float x)
#endif
}
/*********************************************************************
* llrint
*/
static __int64 CDECL unix_llrint(double x)
{
#ifdef HAVE_LLRINT
return llrint(x);
#else
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
#endif
}
/*********************************************************************
* llrintf
*/
@ -858,7 +846,6 @@ static const struct unix_funcs funcs =
unix_ldexp,
unix_lgamma,
unix_lgammaf,
unix_llrint,
unix_llrintf,
unix_log,
unix_logf,

View File

@ -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 *llrint)(double x);
__int64 (CDECL *llrintf)(float x);
double (CDECL *log)(double x);
float (CDECL *logf)(float x);

View File

@ -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 `llrint' function. */
#undef HAVE_LLRINT
/* Define to 1 if you have the `llrintf' function. */
#undef HAVE_LLRINTF