msvcrt: Import modff 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
9984a5d661
commit
29e99741d9
|
@ -922,10 +922,40 @@ float CDECL frexpf( float x, int *exp )
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* modff (MSVCRT.@)
|
* modff (MSVCRT.@)
|
||||||
|
*
|
||||||
|
* Copied from musl: src/math/modff.c
|
||||||
*/
|
*/
|
||||||
float CDECL modff( float x, float *iptr )
|
float CDECL modff( float x, float *iptr )
|
||||||
{
|
{
|
||||||
return unix_funcs->modff( x, 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
|
||||||
|
|
|
@ -459,14 +459,6 @@ static float CDECL unix_logbf( float x )
|
||||||
return logbf( x );
|
return logbf( x );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
|
||||||
* modff
|
|
||||||
*/
|
|
||||||
static float CDECL unix_modff( float x, float *iptr )
|
|
||||||
{
|
|
||||||
return modff( x, iptr );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* pow
|
* pow
|
||||||
*/
|
*/
|
||||||
|
@ -666,7 +658,6 @@ static const struct unix_funcs funcs =
|
||||||
unix_log2f,
|
unix_log2f,
|
||||||
unix_logb,
|
unix_logb,
|
||||||
unix_logbf,
|
unix_logbf,
|
||||||
unix_modff,
|
|
||||||
unix_pow,
|
unix_pow,
|
||||||
unix_powf,
|
unix_powf,
|
||||||
unix_remainder,
|
unix_remainder,
|
||||||
|
|
|
@ -62,7 +62,6 @@ struct unix_funcs
|
||||||
float (CDECL *log2f)(float x);
|
float (CDECL *log2f)(float x);
|
||||||
double (CDECL *logb)(double x);
|
double (CDECL *logb)(double x);
|
||||||
float (CDECL *logbf)(float x);
|
float (CDECL *logbf)(float x);
|
||||||
float (CDECL *modff)(float x, float *iptr);
|
|
||||||
double (CDECL *pow)(double x, double y);
|
double (CDECL *pow)(double x, double y);
|
||||||
float (CDECL *powf)(float x, float y);
|
float (CDECL *powf)(float x, float y);
|
||||||
double (CDECL *remainder)(double x, double y);
|
double (CDECL *remainder)(double x, double y);
|
||||||
|
|
Loading…
Reference in New Issue