diff --git a/configure b/configure index 69b97958832..fe54e30321f 100755 --- a/configure +++ b/configure @@ -19644,8 +19644,7 @@ for ac_func in \ remquof \ tgamma \ tgammaf \ - trunc \ - truncf + trunc do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 7fde36f7616..fb4ec181ea2 100644 --- a/configure.ac +++ b/configure.ac @@ -2684,8 +2684,7 @@ AC_CHECK_FUNCS(\ remquof \ tgamma \ tgammaf \ - trunc \ - truncf + trunc ) LIBS="$ac_save_LIBS" diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 5682b00bb66..246f329ee95 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -4989,10 +4989,24 @@ double CDECL trunc(double x) /********************************************************************* * truncf (MSVCR120.@) + * + * Copied from musl: src/math/truncf.c */ float CDECL truncf(float x) { - return unix_funcs->truncf(x); + union {float f; UINT32 i;} u = {x}; + int e = (u.i >> 23 & 0xff) - 0x7f + 9; + UINT32 m; + + if (e >= 23 + 9) + return x; + if (e < 9) + e = 1; + m = -1U >> e; + if ((u.i & m) == 0) + return x; + u.i &= ~m; + return u.f; } /********************************************************************* diff --git a/dlls/msvcrt/unixlib.c b/dlls/msvcrt/unixlib.c index 83a1e5386c1..e809d7353ff 100644 --- a/dlls/msvcrt/unixlib.c +++ b/dlls/msvcrt/unixlib.c @@ -648,18 +648,6 @@ static double CDECL unix_trunc(double x) #endif } -/********************************************************************* - * truncf - */ -static float CDECL unix_truncf(float x) -{ -#ifdef HAVE_TRUNCF - return truncf(x); -#else - return unix_trunc(x); -#endif -} - /********************************************************************* * tgammaf */ @@ -735,7 +723,6 @@ static const struct unix_funcs funcs = unix_tgamma, unix_tgammaf, unix_trunc, - unix_truncf }; NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out ) diff --git a/dlls/msvcrt/unixlib.h b/dlls/msvcrt/unixlib.h index a86e2d34852..fd279cf5519 100644 --- a/dlls/msvcrt/unixlib.h +++ b/dlls/msvcrt/unixlib.h @@ -83,7 +83,6 @@ struct unix_funcs double (CDECL *tgamma)(double x); float (CDECL *tgammaf)(float x); double (CDECL *trunc)(double x); - float (CDECL *truncf)(float x); }; #endif /* __UNIXLIB_H */ diff --git a/include/config.h.in b/include/config.h.in index ce83ecacd8e..7fe9383a778 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1013,9 +1013,6 @@ /* Define to 1 if you have the `trunc' function. */ #undef HAVE_TRUNC -/* Define to 1 if you have the `truncf' function. */ -#undef HAVE_TRUNCF - /* Define to 1 if you have the `udev' library (-ludev). */ #undef HAVE_UDEV