Signed-off-by: Myah Caron qsniyg@protonmail.com --- v2: Use a newly created MSVCRT_intmax_t type instead of intmax_t, fixes compilation errors.
I didn't add a test to tests/headers.c because it failed to compile when I tried doing so (for the same reason adding MSVCRT_intmax_t was required).
I copied the definition from include/msvcrt/stdint.h.
.../api-ms-win-crt-utility-l1-1-0.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcrt/math.c | 10 ++++++++++ dlls/msvcrt/msvcrt.h | 1 + dlls/ucrtbase/ucrtbase.spec | 2 +- 6 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/api-ms-win-crt-utility-l1-1-0/api-ms-win-crt-utility-l1-1-0.spec b/dlls/api-ms-win-crt-utility-l1-1-0/api-ms-win-crt-utility-l1-1-0.spec index b34147be5fe..511a8389ccf 100644 --- a/dlls/api-ms-win-crt-utility-l1-1-0/api-ms-win-crt-utility-l1-1-0.spec +++ b/dlls/api-ms-win-crt-utility-l1-1-0/api-ms-win-crt-utility-l1-1-0.spec @@ -17,7 +17,7 @@ @ cdecl bsearch(ptr ptr long long ptr) ucrtbase.bsearch @ cdecl bsearch_s(ptr ptr long long ptr ptr) ucrtbase.bsearch_s @ cdecl -ret64 div(long long) ucrtbase.div -@ stub imaxabs +@ cdecl imaxabs(long long) ucrtbase.imaxabs @ stub imaxdiv @ cdecl labs(long) ucrtbase.labs @ cdecl -ret64 ldiv(long long) ucrtbase.ldiv diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index dd7d48a8629..6efd2c99131 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -2210,7 +2210,7 @@ @ cdecl ilogb(double) MSVCR120_ilogb @ cdecl ilogbf(float) MSVCR120_ilogbf @ cdecl ilogbl(double) MSVCR120_ilogbl -@ stub imaxabs +@ cdecl imaxabs(long long) MSVCRT_imaxabs @ stub imaxdiv @ cdecl is_wctype(long long) MSVCRT_iswctype @ cdecl isalnum(long) MSVCRT_isalnum diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index b8ffbbc7581..ac0c3387340 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1874,7 +1874,7 @@ @ cdecl ilogb(double) msvcr120.ilogb @ cdecl ilogbf(float) msvcr120.ilogbf @ cdecl ilogbl(double) msvcr120.ilogbl -@ stub imaxabs +@ cdecl imaxabs(long long) msvcr120.imaxabs @ stub imaxdiv @ cdecl isalnum(long) msvcr120.isalnum @ cdecl isalpha(long) msvcr120.isalpha diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 15d8fa4be72..a9cf224575a 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1502,6 +1502,16 @@ MSVCRT_longlong CDECL MSVCRT_llabs( MSVCRT_longlong n ) } #endif
+#if _MSVCR_VER>=120 +/********************************************************************* + * imaxabs (MSVCR120.@) + */ +MSVCRT_intmax_t CDECL MSVCRT_imaxabs( MSVCRT_intmax_t n ) +{ + return n >= 0 ? n : -n; +} +#endif + /********************************************************************* * _abs64 (MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 6e361201b05..6feb6c873f0 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -77,6 +77,7 @@ typedef unsigned int MSVCRT__fsize_t; typedef int MSVCRT_long; typedef unsigned int MSVCRT_ulong; typedef __int64 MSVCRT_longlong; +typedef long long MSVCRT_intmax_t; #ifdef _WIN64 typedef unsigned __int64 MSVCRT_size_t; typedef __int64 MSVCRT_intptr_t; diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 689b3d7c951..072536911c2 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2344,7 +2344,7 @@ @ cdecl ilogb(double) MSVCR120_ilogb @ cdecl ilogbf(float) MSVCR120_ilogbf @ cdecl ilogbl(double) MSVCR120_ilogbl -@ stub imaxabs +@ cdecl imaxabs(long long) MSVCRT_imaxabs @ stub imaxdiv @ cdecl is_wctype(long long) MSVCRT_iswctype @ cdecl isalnum(long) MSVCRT_isalnum -- 2.28.0
Hi,
On 9/11/20 4:51 PM, Myah Caron wrote:
-@ stub imaxabs +@ cdecl imaxabs(long long) MSVCRT_imaxabs
Please change the spec file entry to: @ cdecl -ret64 imaxabs(int64) MSVCRT_imaxabs
Thanks, Piotr