msvcrt: Implement lrintf using rintf 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:54 +02:00 committed by Alexandre Julliard
parent 0838c995ea
commit aa2248164c
6 changed files with 9 additions and 20 deletions

1
configure vendored
View File

@ -19642,7 +19642,6 @@ for ac_func in \
log1pf \
log2 \
log2f \
lrintf \
nearbyint \
nearbyintf \
nexttoward \

View File

@ -2682,7 +2682,6 @@ AC_CHECK_FUNCS(\
log1pf \
log2 \
log2f \
lrintf \
nearbyint \
nearbyintf \
nexttoward \

View File

@ -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;
}
/*********************************************************************

View File

@ -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,

View File

@ -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);

View File

@ -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