mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 00:42:46 +00:00
msvcrt: Import trunc 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
5544e6de07
commit
f2c1872660
3
configure
vendored
3
configure
vendored
|
@ -19643,8 +19643,7 @@ for ac_func in \
|
|||
remquo \
|
||||
remquof \
|
||||
tgamma \
|
||||
tgammaf \
|
||||
trunc
|
||||
tgammaf
|
||||
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
|
|
|
@ -2683,8 +2683,7 @@ AC_CHECK_FUNCS(\
|
|||
remquo \
|
||||
remquof \
|
||||
tgamma \
|
||||
tgammaf \
|
||||
trunc
|
||||
tgammaf
|
||||
)
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
|
|
|
@ -4981,10 +4981,24 @@ __int64 CDECL llroundf(float x)
|
|||
|
||||
/*********************************************************************
|
||||
* trunc (MSVCR120.@)
|
||||
*
|
||||
* Copied from musl: src/math/trunc.c
|
||||
*/
|
||||
double CDECL trunc(double x)
|
||||
{
|
||||
return unix_funcs->trunc(x);
|
||||
union {double f; UINT64 i;} u = {x};
|
||||
int e = (u.i >> 52 & 0x7ff) - 0x3ff + 12;
|
||||
UINT64 m;
|
||||
|
||||
if (e >= 52 + 12)
|
||||
return x;
|
||||
if (e < 12)
|
||||
e = 1;
|
||||
m = -1ULL >> e;
|
||||
if ((u.i & m) == 0)
|
||||
return x;
|
||||
u.i &= ~m;
|
||||
return u.f;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
|
@ -636,18 +636,6 @@ static double CDECL unix_tgamma(double x)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* trunc
|
||||
*/
|
||||
static double CDECL unix_trunc(double x)
|
||||
{
|
||||
#ifdef HAVE_TRUNC
|
||||
return trunc(x);
|
||||
#else
|
||||
return (x > 0) ? floor(x) : ceil(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* tgammaf
|
||||
*/
|
||||
|
@ -722,7 +710,6 @@ static const struct unix_funcs funcs =
|
|||
unix_tanhf,
|
||||
unix_tgamma,
|
||||
unix_tgammaf,
|
||||
unix_trunc,
|
||||
};
|
||||
|
||||
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
|
||||
|
|
|
@ -82,7 +82,6 @@ struct unix_funcs
|
|||
float (CDECL *tanhf)(float x);
|
||||
double (CDECL *tgamma)(double x);
|
||||
float (CDECL *tgammaf)(float x);
|
||||
double (CDECL *trunc)(double x);
|
||||
};
|
||||
|
||||
#endif /* __UNIXLIB_H */
|
||||
|
|
|
@ -1010,9 +1010,6 @@
|
|||
/* Define to 1 if you have the <tiffio.h> header file. */
|
||||
#undef HAVE_TIFFIO_H
|
||||
|
||||
/* Define to 1 if you have the `trunc' function. */
|
||||
#undef HAVE_TRUNC
|
||||
|
||||
/* Define to 1 if you have the `udev' library (-ludev). */
|
||||
#undef HAVE_UDEV
|
||||
|
||||
|
|
Loading…
Reference in a new issue