msvcrt: Import roundf implementation from musl.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
30200117d2
commit
833e8cdd42
|
@ -19656,7 +19656,6 @@ for ac_func in \
|
||||||
rint \
|
rint \
|
||||||
rintf \
|
rintf \
|
||||||
round \
|
round \
|
||||||
roundf \
|
|
||||||
tgamma \
|
tgamma \
|
||||||
tgammaf \
|
tgammaf \
|
||||||
trunc \
|
trunc \
|
||||||
|
|
|
@ -2699,7 +2699,6 @@ AC_CHECK_FUNCS(\
|
||||||
rint \
|
rint \
|
||||||
rintf \
|
rintf \
|
||||||
round \
|
round \
|
||||||
roundf \
|
|
||||||
tgamma \
|
tgamma \
|
||||||
tgammaf \
|
tgammaf \
|
||||||
trunc \
|
trunc \
|
||||||
|
|
|
@ -4329,10 +4329,33 @@ double CDECL round(double x)
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* roundf (MSVCR120.@)
|
* roundf (MSVCR120.@)
|
||||||
|
*
|
||||||
|
* Copied from musl: src/math/roundf.c
|
||||||
*/
|
*/
|
||||||
float CDECL roundf(float x)
|
float CDECL roundf(float x)
|
||||||
{
|
{
|
||||||
return unix_funcs->roundf(x);
|
static const float toint = 1 / FLT_EPSILON;
|
||||||
|
|
||||||
|
unsigned int ix = *(unsigned int*)&x;
|
||||||
|
int e = ix >> 23 & 0xff;
|
||||||
|
float y;
|
||||||
|
|
||||||
|
if (e >= 0x7f + 23)
|
||||||
|
return x;
|
||||||
|
if (ix >> 31)
|
||||||
|
x = -x;
|
||||||
|
if (e < 0x7f - 1)
|
||||||
|
return 0 * *(float*)&ix;
|
||||||
|
y = fp_barrierf(x + toint) - toint - x;
|
||||||
|
if (y > 0.5f)
|
||||||
|
y = y + x - 1;
|
||||||
|
else if (y <= -0.5f)
|
||||||
|
y = y + x + 1;
|
||||||
|
else
|
||||||
|
y = y + x;
|
||||||
|
if (ix >> 31)
|
||||||
|
y = -y;
|
||||||
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
|
@ -765,18 +765,6 @@ static double CDECL unix_round(double x)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* roundf
|
|
||||||
*/
|
|
||||||
static float CDECL unix_roundf(float x)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_ROUNDF
|
|
||||||
return roundf(x);
|
|
||||||
#else
|
|
||||||
return unix_round(x);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* lround
|
* lround
|
||||||
*/
|
*/
|
||||||
|
@ -1013,7 +1001,6 @@ static const struct unix_funcs funcs =
|
||||||
unix_rint,
|
unix_rint,
|
||||||
unix_rintf,
|
unix_rintf,
|
||||||
unix_round,
|
unix_round,
|
||||||
unix_roundf,
|
|
||||||
unix_sin,
|
unix_sin,
|
||||||
unix_sinf,
|
unix_sinf,
|
||||||
unix_sinh,
|
unix_sinh,
|
||||||
|
|
|
@ -95,7 +95,6 @@ struct unix_funcs
|
||||||
double (CDECL *rint)(double x);
|
double (CDECL *rint)(double x);
|
||||||
float (CDECL *rintf)(float x);
|
float (CDECL *rintf)(float x);
|
||||||
double (CDECL *round)(double x);
|
double (CDECL *round)(double x);
|
||||||
float (CDECL *roundf)(float x);
|
|
||||||
double (CDECL *sin)(double x);
|
double (CDECL *sin)(double x);
|
||||||
float (CDECL *sinf)(float x);
|
float (CDECL *sinf)(float x);
|
||||||
double (CDECL *sinh)(double x);
|
double (CDECL *sinh)(double x);
|
||||||
|
|
|
@ -705,9 +705,6 @@
|
||||||
/* Define to 1 if you have the `round' function. */
|
/* Define to 1 if you have the `round' function. */
|
||||||
#undef HAVE_ROUND
|
#undef HAVE_ROUND
|
||||||
|
|
||||||
/* Define to 1 if you have the `roundf' function. */
|
|
||||||
#undef HAVE_ROUNDF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sasl/sasl.h> header file. */
|
/* Define to 1 if you have the <sasl/sasl.h> header file. */
|
||||||
#undef HAVE_SASL_SASL_H
|
#undef HAVE_SASL_SASL_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue