msvcrt: Import rintf implementation from musl.

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:40 +02:00 committed by Alexandre Julliard
parent cba9981c47
commit ad2ecc6e06
6 changed files with 18 additions and 20 deletions

1
configure vendored
View File

@ -19652,7 +19652,6 @@ for ac_func in \
remainderf \
remquo \
remquof \
rintf \
tgamma \
tgammaf \
trunc \

View File

@ -2692,7 +2692,6 @@ AC_CHECK_FUNCS(\
remainderf \
remquo \
remquof \
rintf \
tgamma \
tgammaf \
trunc \

View File

@ -4312,10 +4312,27 @@ double CDECL rint(double x)
/*********************************************************************
* rintf (MSVCR120.@)
*
* Copied from musl: src/math/rintf.c
*/
float CDECL rintf(float x)
{
return unix_funcs->rintf(x);
static const float toint = 1 / FLT_EPSILON;
unsigned int ix = *(unsigned int*)&x;
int e = ix >> 23 & 0xff;
int s = ix >> 31;
float y;
if (e >= 0x7f + 23)
return x;
if (s)
y = fp_barrierf(x - toint) + toint;
else
y = fp_barrierf(x + toint) - toint;
if (y == 0)
return s ? -0.0f : 0.0f;
return y;
}
/*********************************************************************

View File

@ -729,18 +729,6 @@ static float CDECL unix_remquof(float x, float y, int *quo)
#endif
}
/*********************************************************************
* rintf
*/
static float CDECL unix_rintf(float x)
{
#ifdef HAVE_RINTF
return rintf(x);
#else
return x >= 0 ? floorf(x + 0.5) : ceilf(x - 0.5);
#endif
}
/*********************************************************************
* sin
*/
@ -922,7 +910,6 @@ static const struct unix_funcs funcs =
unix_remainderf,
unix_remquo,
unix_remquof,
unix_rintf,
unix_sin,
unix_sinf,
unix_sinh,

View File

@ -88,7 +88,6 @@ struct unix_funcs
float (CDECL *remainderf)(float x, float y);
double (CDECL *remquo)(double x, double y, int *quo);
float (CDECL *remquof)(float x, float y, int *quo);
float (CDECL *rintf)(float x);
double (CDECL *sin)(double x);
float (CDECL *sinf)(float x);
double (CDECL *sinh)(double x);

View File

@ -684,9 +684,6 @@
/* Define to 1 if you have the `res_getservers' function. */
#undef HAVE_RES_GETSERVERS
/* Define to 1 if you have the `rintf' function. */
#undef HAVE_RINTF
/* Define to 1 if you have the <sasl/sasl.h> header file. */
#undef HAVE_SASL_SASL_H