From: Alexandre Julliard julliard@winehq.org
--- dlls/msvcrt/math.c | 55 ++----------------------------------- libs/musl/src/math/ilogb.c | 3 -- libs/musl/src/math/ilogbf.c | 3 -- 3 files changed, 2 insertions(+), 59 deletions(-)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 61c95512448..a000d9196df 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -259,24 +259,6 @@ float CDECL _nextafterf( float x, float y ) return y; }
-/* Copied from musl: src/math/ilogbf.c */ -static int __ilogbf(float x) -{ - union { float f; UINT32 i; } u = { x }; - int e = u.i >> 23 & 0xff; - - if (!e) - { - u.i <<= 9; - if (u.i == 0) return FP_ILOGB0; - /* subnormal x */ - for (e = -0x7f; u.i >> 31 == 0; e--, u.i <<= 1); - return e; - } - if (e == 0xff) return u.i << 9 ? FP_ILOGBNAN : INT_MAX; - return e - 0x7f; -} - /********************************************************************* * _logbf (MSVCRT.@) * @@ -290,7 +272,7 @@ float CDECL _logbf(float x) *_errno() = ERANGE; return -1 / (x * x); } - return __ilogbf(x); + return ilogbf(x); }
#endif @@ -4522,24 +4504,6 @@ __int64 CDECL _abs64( __int64 n ) return n >= 0 ? n : -n; }
-/* Copied from musl: src/math/ilogb.c */ -static int __ilogb(double x) -{ - union { double f; UINT64 i; } u = { x }; - int e = u.i >> 52 & 0x7ff; - - if (!e) - { - u.i <<= 12; - if (u.i == 0) return FP_ILOGB0; - /* subnormal x */ - for (e = -0x3ff; u.i >> 63 == 0; e--, u.i <<= 1); - return e; - } - if (e == 0x7ff) return u.i << 12 ? FP_ILOGBNAN : INT_MAX; - return e - 0x3ff; -} - /********************************************************************* * _logb (MSVCRT.@) * @@ -4551,7 +4515,7 @@ double CDECL _logb(double x) return x * x; if (x == 0) return math_error(_SING, "_logb", x, 0, -1 / (x * x)); - return __ilogb(x); + return ilogb(x); }
/********************************************************************* @@ -9866,19 +9830,4 @@ double CDECL MSVCR120_creal(_Dcomplex z) return z._Val[0]; }
-/********************************************************************* - * ilogb (MSVCR120.@) - */ -int CDECL ilogb(double x) -{ - return __ilogb(x); -} - -/********************************************************************* - * ilogbf (MSVCR120.@) - */ -int CDECL ilogbf(float x) -{ - return __ilogbf(x); -} #endif /* _MSVCR_VER>=120 */ diff --git a/libs/musl/src/math/ilogb.c b/libs/musl/src/math/ilogb.c index 9351411a5aa..12738446ef0 100644 --- a/libs/musl/src/math/ilogb.c +++ b/libs/musl/src/math/ilogb.c @@ -3,7 +3,6 @@
int __cdecl ilogb(double x) { - #pragma STDC FENV_ACCESS ON union {double f; uint64_t i;} u = {x}; uint64_t i = u.i; int e = i>>52 & 0x7ff; @@ -11,7 +10,6 @@ int __cdecl ilogb(double x) if (!e) { i <<= 12; if (i == 0) { - FORCE_EVAL(0/0.0f); return FP_ILOGB0; } /* subnormal x */ @@ -19,7 +17,6 @@ int __cdecl ilogb(double x) return e; } if (e == 0x7ff) { - FORCE_EVAL(0/0.0f); return i<<12 ? FP_ILOGBNAN : INT_MAX; } return e - 0x3ff; diff --git a/libs/musl/src/math/ilogbf.c b/libs/musl/src/math/ilogbf.c index 65ee300531b..2eab40cd1a4 100644 --- a/libs/musl/src/math/ilogbf.c +++ b/libs/musl/src/math/ilogbf.c @@ -3,7 +3,6 @@
int __cdecl ilogbf(float x) { - #pragma STDC FENV_ACCESS ON union {float f; uint32_t i;} u = {x}; uint32_t i = u.i; int e = i>>23 & 0xff; @@ -11,7 +10,6 @@ int __cdecl ilogbf(float x) if (!e) { i <<= 9; if (i == 0) { - FORCE_EVAL(0/0.0f); return FP_ILOGB0; } /* subnormal x */ @@ -19,7 +17,6 @@ int __cdecl ilogbf(float x) return e; } if (e == 0xff) { - FORCE_EVAL(0/0.0f); return i<<9 ? FP_ILOGBNAN : INT_MAX; } return e - 0x7f;