From: Piotr Caban piotr@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57963 --- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/math.c | 15 +++++++++++++++ dlls/ucrtbase/tests/misc.c | 14 ++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- 5 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index daa3d350cce..5c588bd5889 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2212,7 +2212,7 @@ @ cdecl ilogbf(float) @ cdecl ilogbl(double) ilogb @ cdecl -ret64 imaxabs(int64) -@ stub imaxdiv +@ cdecl -norelay imaxdiv(int64 int64) @ cdecl is_wctype(long long) iswctype @ cdecl isalnum(long) @ cdecl isalpha(long) diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 1d8ea83a468..fc2ac655c40 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1877,7 +1877,7 @@ @ cdecl ilogbf(float) msvcr120.ilogbf @ cdecl ilogbl(double) msvcr120.ilogbl @ cdecl -ret64 imaxabs(int64) msvcr120.imaxabs -@ stub imaxdiv +@ cdecl -norelay imaxdiv(int64 int64) msvcr120.imaxdiv @ cdecl isalnum(long) msvcr120.isalnum @ cdecl isalpha(long) msvcr120.isalpha @ cdecl isblank(long) msvcr120.isblank diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index c2b5e280451..b639718eb77 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -40,6 +40,7 @@ #include <stdio.h> #include <fenv.h> #include <fpieee.h> +#include <inttypes.h> #include <limits.h> #include <locale.h> #include <math.h> @@ -2091,6 +2092,20 @@ lldiv_t CDECL lldiv(__int64 num, __int64 denom) } #endif
+#if _MSVCR_VER>=120 +/********************************************************************* + * imaxdiv (MSVCR100.@) + */ +imaxdiv_t CDECL imaxdiv(intmax_t num, intmax_t denom) +{ + imaxdiv_t ret; + + ret.quot = num / denom; + ret.rem = num % denom; + return ret; +} +#endif + #ifdef __i386__
/********************************************************************* diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index 8c1e15e4dc0..db209ba802f 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -23,6 +23,7 @@ #include <stdio.h> #include <math.h> #include <float.h> +#include <inttypes.h> #include <io.h> #include <sys/stat.h> #include <share.h> @@ -523,6 +524,7 @@ static void test__sopen_s(void)
static void test_lldiv(void) { + imaxdiv_t div_res; lldiv_t r;
r = lldiv(((LONGLONG)0x111 << 32) + 0x222, (LONGLONG)1 << 32); @@ -536,6 +538,18 @@ static void test_lldiv(void) r = lldiv(((LONGLONG)0x243A5678 << 32) + 0x9ABCDEF0, (LONGLONG)0x12 << 48); ok(r.quot == 0x0203, "quot = %s\n", wine_dbgstr_longlong(r.quot)); ok(r.rem == ((LONGLONG)0x00045678 << 32) + 0x9ABCDEF0, "rem = %s\n", wine_dbgstr_longlong(r.rem)); + + div_res = imaxdiv(((intmax_t)0x111 << 32) + 0x222, (intmax_t)1 << 32); + ok(div_res.quot == 0x111, "quot = %s\n", wine_dbgstr_longlong(div_res.quot)); + ok(div_res.rem == 0x222, "rem = %s\n", wine_dbgstr_longlong(div_res.rem)); + + div_res = imaxdiv(((intmax_t)0x69CF0012 << 32) + 0x0033E78A, 0x30); + ok(div_res.quot == ((intmax_t)0x02345000 << 32) + 0x600114D2, "quot = %s\n", wine_dbgstr_longlong(div_res.quot)); + ok(div_res.rem == 0x2A, "rem = %s\n", wine_dbgstr_longlong(div_res.rem)); + + div_res = imaxdiv(((intmax_t)0x243A5678 << 32) + 0x9ABCDEF0, (intmax_t)0x12 << 48); + ok(div_res.quot == 0x0203, "quot = %s\n", wine_dbgstr_longlong(div_res.quot)); + ok(div_res.rem == ((intmax_t)0x00045678 << 32) + 0x9ABCDEF0, "rem = %s\n", wine_dbgstr_longlong(div_res.rem)); }
static void test_isblank(void) diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index d7b62aa7f46..e03e0b51d60 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2348,7 +2348,7 @@ @ cdecl ilogbf(float) @ cdecl ilogbl(double) ilogb @ cdecl -ret64 imaxabs(int64) -@ stub imaxdiv +@ cdecl -norelay imaxdiv(int64 int64) @ cdecl is_wctype(long long) iswctype @ cdecl isalnum(long) @ cdecl isalpha(long)