mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 15:20:47 +00:00
msvcrt: Import ilogb() from musl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
44e122e04e
commit
48028c64ea
2
configure
vendored
2
configure
vendored
|
@ -19512,8 +19512,6 @@ for ac_func in \
|
||||||
expm1f \
|
expm1f \
|
||||||
fma \
|
fma \
|
||||||
fmaf \
|
fmaf \
|
||||||
ilogb \
|
|
||||||
ilogbf \
|
|
||||||
j0 \
|
j0 \
|
||||||
j1 \
|
j1 \
|
||||||
jn \
|
jn \
|
||||||
|
|
|
@ -2698,8 +2698,6 @@ AC_CHECK_FUNCS(\
|
||||||
expm1f \
|
expm1f \
|
||||||
fma \
|
fma \
|
||||||
fmaf \
|
fmaf \
|
||||||
ilogb \
|
|
||||||
ilogbf \
|
|
||||||
j0 \
|
j0 \
|
||||||
j1 \
|
j1 \
|
||||||
jn \
|
jn \
|
||||||
|
|
|
@ -4402,32 +4402,53 @@ double CDECL MSVCR120_creal(_Dcomplex z)
|
||||||
return z.x;
|
return z.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* ilogb (MSVCR120.@)
|
||||||
|
*
|
||||||
|
* Copied from musl: src/math/ilogb.c
|
||||||
|
*/
|
||||||
int CDECL MSVCR120_ilogb(double x)
|
int CDECL MSVCR120_ilogb(double x)
|
||||||
{
|
{
|
||||||
if (!x) return MSVCRT_FP_ILOGB0;
|
union { double f; UINT64 i; } u = { x };
|
||||||
if (isnan(x)) return MSVCRT_FP_ILOGBNAN;
|
int e = u.i >> 52 & 0x7ff;
|
||||||
if (isinf(x)) return MSVCRT_INT_MAX;
|
|
||||||
|
|
||||||
#ifdef HAVE_ILOGB
|
if (!e)
|
||||||
return ilogb(x);
|
{
|
||||||
#else
|
u.i <<= 12;
|
||||||
return logb(x);
|
if (u.i == 0) return MSVCRT_FP_ILOGB0;
|
||||||
#endif
|
/* subnormal x */
|
||||||
|
for (e = -0x3ff; u.i >> 63 == 0; e--, u.i <<= 1);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
if (e == 0x7ff) return u.i << 12 ? MSVCRT_FP_ILOGBNAN : MSVCRT_INT_MAX;
|
||||||
|
return e - 0x3ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* ilogbf (MSVCR120.@)
|
||||||
|
*
|
||||||
|
* Copied from musl: src/math/ilogbf.c
|
||||||
|
*/
|
||||||
int CDECL MSVCR120_ilogbf(float x)
|
int CDECL MSVCR120_ilogbf(float x)
|
||||||
{
|
{
|
||||||
if (!x) return MSVCRT_FP_ILOGB0;
|
union { float f; UINT32 i; } u = { x };
|
||||||
if (isnan(x)) return MSVCRT_FP_ILOGBNAN;
|
int e = u.i >> 23 & 0xff;
|
||||||
if (isinf(x)) return MSVCRT_INT_MAX;
|
|
||||||
|
|
||||||
#ifdef HAVE_ILOGBF
|
if (!e)
|
||||||
return ilogbf(x);
|
{
|
||||||
#else
|
u.i <<= 9;
|
||||||
return logbf(x);
|
if (u.i == 0) return MSVCRT_FP_ILOGB0;
|
||||||
#endif
|
/* subnormal x */
|
||||||
|
for (e = -0x7f; u.i >> 31 == 0; e--, u.i <<= 1);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
if (e == 0xff) return u.i << 9 ? MSVCRT_FP_ILOGBNAN : MSVCRT_INT_MAX;
|
||||||
|
return e - 0x7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* ilogbl (MSVCR120.@)
|
||||||
|
*/
|
||||||
int CDECL MSVCR120_ilogbl(LDOUBLE x)
|
int CDECL MSVCR120_ilogbl(LDOUBLE x)
|
||||||
{
|
{
|
||||||
return MSVCR120_ilogb(x);
|
return MSVCR120_ilogb(x);
|
||||||
|
|
|
@ -288,12 +288,6 @@
|
||||||
/* Define to 1 if you have the `if_nameindex' function. */
|
/* Define to 1 if you have the `if_nameindex' function. */
|
||||||
#undef HAVE_IF_NAMEINDEX
|
#undef HAVE_IF_NAMEINDEX
|
||||||
|
|
||||||
/* Define to 1 if you have the `ilogb' function. */
|
|
||||||
#undef HAVE_ILOGB
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ilogbf' function. */
|
|
||||||
#undef HAVE_ILOGBF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inet/mib2.h> header file. */
|
/* Define to 1 if you have the <inet/mib2.h> header file. */
|
||||||
#undef HAVE_INET_MIB2_H
|
#undef HAVE_INET_MIB2_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue