在 2026-2-20 09:24, David Grayson 写道:
I added tests for these macros in my test suite here, and also ran those tests against MSVC: http://github.com/DavidEGrayson/intsafeThe only notable difference between this and MSVC is that the smaller-valued macros will have type "int" because we want the C/C++ preprocessor to be able to read them. From fa45f75575d2b70d0fbae6345e59d6309a66fcbb Mon Sep 17 00:00:00 2001 From: David Grayson <[email protected]> Date: Thu, 19 Feb 2026 17:07:19 -0800 Subject: [PATCH 2/2] headers/intsafe: Add missing MIN/MAX macros. - The first block was copied from stdint.h. - The second block was copied from limits.h, but typically GCC overrides them by installing its own limits.h, so we use ifndef for these ones. - The third block was copied from cfgmgr32.h. - The fourth block consists of definitions that we don't have in any other headers. Signed-off-by: David Grayson <[email protected]> --- mingw-w64-headers/include/intsafe.h | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/mingw-w64-headers/include/intsafe.h b/mingw-w64-headers/include/intsafe.h index bad9f38fe..82d07ec81 100644 --- a/mingw-w64-headers/include/intsafe.h +++ b/mingw-w64-headers/include/intsafe.h @@ -14,6 +14,76 @@ #include <wtypesbase.h> #include <specstrings.h> +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807LL - 1) +#define INT8_MAX 127 +#define INT16_MAX 32767 +#define INT32_MAX 2147483647 +#define INT64_MAX 9223372036854775807LL +#define UINT8_MAX 255 +#define UINT16_MAX 65535 +#define UINT32_MAX 0xffffffffU +#define UINT64_MAX 0xffffffffffffffffULL
Similarly to the other patch, on Cygwin or MSYS2, `uint64_t` is `unsigned long`, so it's better to drop `LL` here.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
