Commit 411b6f58 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Import frexpf implementation from musl.

parent 81c58e7d
...@@ -1611,10 +1611,28 @@ float CDECL floorf( float x ) ...@@ -1611,10 +1611,28 @@ float CDECL floorf( float x )
/********************************************************************* /*********************************************************************
* frexpf (MSVCRT.@) * 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;
} }
/********************************************************************* /*********************************************************************
......
...@@ -95,14 +95,6 @@ static float CDECL unix_fmaf( float x, float y, float z ) ...@@ -95,14 +95,6 @@ static float CDECL unix_fmaf( float x, float y, float z )
} }
/********************************************************************* /*********************************************************************
* frexpf
*/
static float CDECL unix_frexpf( float x, int *exp )
{
return frexpf( x, exp );
}
/*********************************************************************
* hypot * hypot
*/ */
static double CDECL unix_hypot(double x, double y) static double CDECL unix_hypot(double x, double y)
...@@ -273,7 +265,6 @@ static const struct unix_funcs funcs = ...@@ -273,7 +265,6 @@ static const struct unix_funcs funcs =
unix_exp2, unix_exp2,
unix_exp2f, unix_exp2f,
unix_fmaf, unix_fmaf,
unix_frexpf,
unix_hypot, unix_hypot,
unix_hypotf, unix_hypotf,
unix_lgamma, unix_lgamma,
......
...@@ -28,7 +28,6 @@ struct unix_funcs ...@@ -28,7 +28,6 @@ struct unix_funcs
double (CDECL *exp2)(double x); double (CDECL *exp2)(double x);
float (CDECL *exp2f)(float x); float (CDECL *exp2f)(float x);
float (CDECL *fmaf)(float x, float y, float z); float (CDECL *fmaf)(float x, float y, float z);
float (CDECL *frexpf)(float x, int *exp);
double (CDECL *hypot)(double x, double y); double (CDECL *hypot)(double x, double y);
float (CDECL *hypotf)(float x, float y); float (CDECL *hypotf)(float x, float y);
double (CDECL *lgamma)(double x); double (CDECL *lgamma)(double x);
......
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