Commit e5808e20 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Use the modf()/modff() implementation from the bundled musl library.

parent be147a80
...@@ -2009,44 +2009,6 @@ float CDECL floorf( float x ) ...@@ -2009,44 +2009,6 @@ float CDECL floorf( float x )
return u.f; return u.f;
} }
/*********************************************************************
* modff (MSVCRT.@)
*
* Copied from musl: src/math/modff.c
*/
float CDECL modff( float x, float *iptr )
{
union {float f; UINT32 i;} u = {x};
UINT32 mask;
int e = (u.i >> 23 & 0xff) - 0x7f;
/* no fractional part */
if (e >= 23) {
*iptr = x;
if (e == 0x80 && u.i << 9 != 0) { /* nan */
return x;
}
u.i &= 0x80000000;
return u.f;
}
/* no integral part */
if (e < 0) {
u.i &= 0x80000000;
*iptr = u.f;
return x;
}
mask = 0x007fffff >> e;
if ((u.i & mask) == 0) {
*iptr = x;
u.i &= 0x80000000;
return u.f;
}
u.i &= ~mask;
*iptr = u.f;
return x - u.f;
}
#endif #endif
/********************************************************************* /*********************************************************************
...@@ -5053,44 +5015,6 @@ float CDECL fmaf( float x, float y, float z ) ...@@ -5053,44 +5015,6 @@ float CDECL fmaf( float x, float y, float z )
return u.f; return u.f;
} }
/*********************************************************************
* modf (MSVCRT.@)
*
* Copied from musl: src/math/modf.c
*/
double CDECL modf( double x, double *iptr )
{
union {double f; UINT64 i;} u = {x};
UINT64 mask;
int e = (u.i >> 52 & 0x7ff) - 0x3ff;
/* no fractional part */
if (e >= 52) {
*iptr = x;
if (e == 0x400 && u.i << 12 != 0) /* nan */
return x;
u.i &= 1ULL << 63;
return u.f;
}
/* no integral part*/
if (e < 0) {
u.i &= 1ULL << 63;
*iptr = u.f;
return x;
}
mask = -1ULL >> 12 >> e;
if ((u.i & mask) == 0) {
*iptr = x;
u.i &= 1ULL << 63;
return u.f;
}
u.i &= ~mask;
*iptr = u.f;
return x - u.f;
}
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
static void _setfp_sse( unsigned int *cw, unsigned int cw_mask, static void _setfp_sse( unsigned int *cw, unsigned int cw_mask,
unsigned int *sw, unsigned int sw_mask ) unsigned int *sw, unsigned int sw_mask )
......
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