Module: wine Branch: stable Commit: 3838bc9698c20a74284e0137fe5a1f6b96d0e7f3 URL: https://source.winehq.org/git/wine.git/?a=commit;h=3838bc9698c20a74284e0137f...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Feb 28 21:08:13 2019 +0100
ucrtbase: Add ilogb* functions.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 8c8d8e80f558e8b0de410196ce4bcc9c77b91edf) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
configure | 2 ++ configure.ac | 2 ++ .../api-ms-win-crt-math-l1-1-0.spec | 6 ++--- dlls/msvcr120/msvcr120.spec | 6 ++--- dlls/msvcr120_app/msvcr120_app.spec | 6 ++--- dlls/msvcrt/math.c | 31 ++++++++++++++++++++++ dlls/msvcrt/msvcrt.h | 4 +++ dlls/ucrtbase/ucrtbase.spec | 6 ++--- include/config.h.in | 6 +++++ 9 files changed, 57 insertions(+), 12 deletions(-)
diff --git a/configure b/configure index 2220d16..a4c835c 100755 --- a/configure +++ b/configure @@ -18605,6 +18605,8 @@ for ac_func in \ exp2f \ expm1 \ expm1f \ + ilogb \ + ilogbf \ j0 \ j1 \ jn \ diff --git a/configure.ac b/configure.ac index fe7ad4e..8493778 100644 --- a/configure.ac +++ b/configure.ac @@ -2743,6 +2743,8 @@ AC_CHECK_FUNCS(\ exp2f \ expm1 \ expm1f \ + ilogb \ + ilogbf \ j0 \ j1 \ jn \ diff --git a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec index f5e4fb1..dea5094 100644 --- a/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec +++ b/dlls/api-ms-win-crt-math-l1-1-0/api-ms-win-crt-math-l1-1-0.spec @@ -254,9 +254,9 @@ @ cdecl -arch=arm,x86_64,arm64 fmodf(float float) ucrtbase.fmodf @ cdecl frexp(double ptr) ucrtbase.frexp @ cdecl hypot(double double) ucrtbase.hypot -@ stub ilogb -@ stub ilogbf -@ stub ilogbl +@ cdecl ilogb(double) ucrtbase.ilogb +@ cdecl ilogbf(float) ucrtbase.ilogbf +@ cdecl ilogbl(double) ucrtbase.ilogbl @ cdecl ldexp(double long) ucrtbase.ldexp @ cdecl lgamma(double) ucrtbase.lgamma @ cdecl lgammaf(float) ucrtbase.lgammaf diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 478248d..4ddead9 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2207,9 +2207,9 @@ @ cdecl gets_s(ptr long) MSVCRT_gets_s @ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwchar() MSVCRT_getwchar -@ stub ilogb -@ stub ilogbf -@ stub ilogbl +@ cdecl ilogb(double) MSVCR120_ilogb +@ cdecl ilogbf(float) MSVCR120_ilogbf +@ cdecl ilogbl(double) MSVCR120_ilogbl @ stub imaxabs @ stub imaxdiv @ cdecl is_wctype(long long) ntdll.iswctype diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 706799c..54de44b 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1871,9 +1871,9 @@ @ cdecl gets_s(ptr long) msvcr120.gets_s @ cdecl getwc(ptr) msvcr120.getwc @ cdecl getwchar() msvcr120.getwchar -@ stub ilogb -@ stub ilogbf -@ stub ilogbl +@ cdecl ilogb(double) msvcr120.ilogb +@ cdecl ilogbf(float) msvcr120.ilogbf +@ cdecl ilogbl(double) msvcr120.ilogbl @ stub imaxabs @ stub imaxdiv @ cdecl isalnum(long) msvcr120.isalnum diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index dc12cb1..ca181d9 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -3433,4 +3433,35 @@ double CDECL MSVCR120_creal(_Dcomplex z) return z.x; }
+int CDECL MSVCR120_ilogb(double x) +{ + if (!x) return MSVCRT_FP_ILOGB0; + if (isnan(x)) return MSVCRT_FP_ILOGBNAN; + if (isinf(x)) return MSVCRT_INT_MAX; + +#ifdef HAVE_ILOGB + return ilogb(x); +#else + return logb(x); +#endif +} + +int CDECL MSVCR120_ilogbf(float x) +{ + if (!x) return MSVCRT_FP_ILOGB0; + if (isnan(x)) return MSVCRT_FP_ILOGBNAN; + if (isinf(x)) return MSVCRT_INT_MAX; + +#ifdef HAVE_ILOGBF + return ilogbf(x); +#else + return logbf(x); +#endif +} + +int CDECL MSVCR120_ilogbl(LDOUBLE x) +{ + return MSVCR120_ilogb(x); +} + #endif /* _MSVCR_VER>=120 */ diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 02b8628..8654218 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -41,6 +41,7 @@ #include "windef.h" #include "winbase.h"
+#define MSVCRT_INT_MAX 0x7fffffff #define MSVCRT_LONG_MAX 0x7fffffff #define MSVCRT_LONG_MIN (-MSVCRT_LONG_MAX-1) #define MSVCRT_ULONG_MAX 0xffffffff @@ -1185,6 +1186,9 @@ printf_arg arg_clbk_positional(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN; #define MSVCRT__OVERFLOW 3 #define MSVCRT__UNDERFLOW 4
+#define MSVCRT_FP_ILOGB0 (-MSVCRT_INT_MAX - 1) +#define MSVCRT_FP_ILOGBNAN MSVCRT_INT_MAX + typedef struct { float f; diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 6b87bd1..2e5e102 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2341,9 +2341,9 @@ @ cdecl getwc(ptr) MSVCRT_getwc @ cdecl getwchar() MSVCRT_getwchar @ cdecl hypot(double double) _hypot -@ stub ilogb -@ stub ilogbf -@ stub ilogbl +@ cdecl ilogb(double) MSVCR120_ilogb +@ cdecl ilogbf(float) MSVCR120_ilogbf +@ cdecl ilogbl(double) MSVCR120_ilogbl @ stub imaxabs @ stub imaxdiv @ cdecl is_wctype(long long) ntdll.iswctype diff --git a/include/config.h.in b/include/config.h.in index af8783a..05a7147 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -300,6 +300,12 @@ /* Define to 1 if you have the `if_nameindex' function. */ #undef HAVE_IF_NAMEINDEX
+/* Define to 1 if you have the `ilogb' function. */ +#undef HAVE_ILOGB + +/* Define to 1 if you have the `ilogbf' function. */ +#undef HAVE_ILOGBF + /* Define to 1 if you have the `inet_addr' function. */ #undef HAVE_INET_ADDR