msvcrt: Import frexpf implementation from musl.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-06-03 16:28:56 +02:00 committed by Alexandre Julliard
parent 81c58e7d49
commit 411b6f5842
3 changed files with 20 additions and 12 deletions

View File

@ -1611,10 +1611,28 @@ float CDECL floorf( float x )
/*********************************************************************
* frexpf (MSVCRT.@)
*
* Copied from musl: src/math/frexpf.c
*/
float CDECL frexpf( float x, int *exp )
float CDECL frexpf( float x, int *e )
{
return unix_funcs->frexpf( x, exp );
UINT32 ux = *(UINT32*)&x;
int ee = ux >> 23 & 0xff;
if (!ee) {
if (x) {
x = frexpf(x * 0x1p64, e);
*e -= 64;
} else *e = 0;
return x;
} else if (ee == 0xff) {
return x;
}
*e = ee - 0x7e;
ux &= 0x807ffffful;
ux |= 0x3f000000ul;
return *(float*)&ux;
}
/*********************************************************************

View File

@ -94,14 +94,6 @@ static float CDECL unix_fmaf( float x, float y, float z )
#endif
}
/*********************************************************************
* frexpf
*/
static float CDECL unix_frexpf( float x, int *exp )
{
return frexpf( x, exp );
}
/*********************************************************************
* hypot
*/
@ -273,7 +265,6 @@ static const struct unix_funcs funcs =
unix_exp2,
unix_exp2f,
unix_fmaf,
unix_frexpf,
unix_hypot,
unix_hypotf,
unix_lgamma,

View File

@ -28,7 +28,6 @@ struct unix_funcs
double (CDECL *exp2)(double x);
float (CDECL *exp2f)(float x);
float (CDECL *fmaf)(float x, float y, float z);
float (CDECL *frexpf)(float x, int *exp);
double (CDECL *hypot)(double x, double y);
float (CDECL *hypotf)(float x, float y);
double (CDECL *lgamma)(double x);