Commit 1cff65b6 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Use the logb()/logbf() implementation from the bundled musl library.

parent d1ba9a30
......@@ -179,7 +179,7 @@
@ cdecl _loaddll(str)
@ cdecl -arch=i386 _local_unwind2(ptr long)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl _logb(double) logb
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
@ cdecl _lsearch(ptr ptr ptr long ptr)
......
......@@ -1052,8 +1052,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -1409,8 +1409,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -1420,8 +1420,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......@@ -2266,9 +2266,9 @@
@ cdecl log2(double)
@ cdecl log2f(float)
@ cdecl log2l(double) log2
@ cdecl logb(double) _logb
@ cdecl logbf(float) _logbf
@ cdecl logbl(double) _logb
@ cdecl logb(double)
@ cdecl logbf(float)
@ cdecl logbl(double) logb
@ cdecl -arch=i386,x86_64,arm,arm64 longjmp(ptr long) MSVCRT_longjmp
@ cdecl lrint(double)
@ cdecl lrintf(float)
......
......@@ -408,7 +408,7 @@
@ cdecl _localtime64(ptr)
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -403,7 +403,7 @@
@ cdecl _localtime64(ptr)
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -724,8 +724,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -702,8 +702,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -131,7 +131,7 @@ int CDECL _matherr(struct _exception *e)
}
static double math_error(int type, const char *name, double arg1, double arg2, double retval)
double math_error(int type, const char *name, double arg1, double arg2, double retval)
{
struct _exception exception = {type, (char *)name, arg1, arg2, retval};
......@@ -259,22 +259,6 @@ float CDECL _nextafterf( float x, float y )
return y;
}
/*********************************************************************
* _logbf (MSVCRT.@)
*
* Copied from musl: src/math/logbf.c
*/
float CDECL _logbf(float x)
{
if (!isfinite(x))
return x * x;
if (x == 0) {
*_errno() = ERANGE;
return -1 / (x * x);
}
return ilogbf(x);
}
#endif
/* Copied from musl: src/math/__rem_pio2_large.c */
......@@ -4505,20 +4489,6 @@ __int64 CDECL _abs64( __int64 n )
}
/*********************************************************************
* _logb (MSVCRT.@)
*
* Copied from musl: src/math/logb.c
*/
double CDECL _logb(double x)
{
if (!isfinite(x))
return x * x;
if (x == 0)
return math_error(_SING, "_logb", x, 0, -1 / (x * x));
return ilogb(x);
}
/*********************************************************************
* ceil (MSVCRT.@)
*
* Based on musl: src/math/ceilf.c
......
......@@ -670,8 +670,8 @@
@ cdecl _lock(long)
@ cdecl _lock_file(ptr)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -385,7 +385,7 @@
@ cdecl -arch=i386 _local_unwind2(ptr long)
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl _logb(double) logb
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......
......@@ -568,8 +568,8 @@
@ cdecl _lock_file(ptr)
@ cdecl _lock_locales()
@ cdecl _locking(long long long)
@ cdecl _logb(double)
@ cdecl -arch=!i386 _logbf(float)
@ cdecl _logb(double) logb
@ cdecl -arch=!i386 _logbf(float) logbf
@ cdecl -arch=i386 _longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long) MSVCRT__lrotl
@ cdecl _lrotr(long long) MSVCRT__lrotr
......@@ -1142,8 +1142,8 @@
@ cdecl _o__localtime64_s(ptr ptr) _localtime64_s
@ cdecl _o__lock_file(ptr) _lock_file
@ cdecl _o__locking(long long long) _locking
@ cdecl _o__logb(double) _logb
@ cdecl -arch=!i386 _o__logbf(float) _logbf
@ cdecl _o__logb(double) logb
@ cdecl -arch=!i386 _o__logbf(float) logbf
@ cdecl _o__lsearch(ptr ptr ptr long ptr) _lsearch
@ stub _o__lsearch_s
@ cdecl _o__lseek(long long long) _lseek
......@@ -1699,9 +1699,9 @@
@ cdecl _o_log2(double) log2
@ cdecl _o_log2f(float) log2f
@ cdecl _o_log2l(double) log2
@ cdecl _o_logb(double) _logb
@ cdecl _o_logbf(float) _logbf
@ cdecl _o_logbl(double) _logb
@ cdecl _o_logb(double) logb
@ cdecl _o_logbf(float) logbf
@ cdecl _o_logbl(double) logb
@ cdecl -arch=!i386 _o_logf(float) logf
@ cdecl _o_lrint(double) lrint
@ cdecl _o_lrintf(float) lrintf
......@@ -2401,9 +2401,9 @@
@ cdecl log2(double)
@ cdecl log2f(float)
@ cdecl log2l(double) log2
@ cdecl logb(double) _logb
@ cdecl logbf(float) _logbf
@ cdecl logbl(double) _logb
@ cdecl logb(double)
@ cdecl logbf(float)
@ cdecl logbl(double) logb
@ cdecl -arch=!i386 logf(float)
@ cdecl -arch=i386,x86_64,arm,arm64 longjmp(ptr long) MSVCRT_longjmp
@ cdecl lrint(double)
......
......@@ -10,6 +10,8 @@
typedef float float_t;
typedef double double_t;
hidden double math_error(int type, const char *name, double arg1, double arg2, double retval);
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN
union ldshape {
......
......@@ -13,6 +13,6 @@ double __cdecl logb(double x)
if (!isfinite(x))
return x * x;
if (x == 0)
return -1/(x*x);
return math_error(_SING, "_logb", x, 0, -1 / (x * x));
return ilogb(x);
}
#include <math.h>
#include "libm.h"
float __cdecl logbf(float x)
{
if (!isfinite(x))
return x * x;
if (x == 0)
if (x == 0) {
errno = ERANGE;
return -1/(x*x);
}
return ilogbf(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