Commit ad2ecc6e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Import rintf implementation from musl.

parent cba9981c
......@@ -19652,7 +19652,6 @@ for ac_func in \
remainderf \
remquo \
remquof \
rintf \
tgamma \
tgammaf \
trunc \
......
......@@ -2692,7 +2692,6 @@ AC_CHECK_FUNCS(\
remainderf \
remquo \
remquof \
rintf \
tgamma \
tgammaf \
trunc \
......
......@@ -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;
}
/*********************************************************************
......
......@@ -730,18 +730,6 @@ static float CDECL unix_remquof(float x, float y, int *quo)
}
/*********************************************************************
* 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
*/
static double CDECL unix_sin( double x )
......@@ -922,7 +910,6 @@ static const struct unix_funcs funcs =
unix_remainderf,
unix_remquo,
unix_remquof,
unix_rintf,
unix_sin,
unix_sinf,
unix_sinh,
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment