Define the right long limits for Windows.
@@ -23,13 +23,23 @@ static char limits_str[]
"#define INT_MAX 2147483647\n"
"#define UINT_MAX (INT_MAX * 2u + 1u)\n"
"\n"
+#if defined(_WIN32)
+ "#define LONG_MIN (-LONG_MAX - 1l)\n"
+ "#define LONG_MAX 2147483647l\n"
+ "#define ULONG_MAX (LONG_MAX * 2ul + 1ul)\n"
+ "\n"
+ "#define LLONG_MIN (-LLONG_MAX - 1ll)\n"
+ "#define LLONG_MAX 9223372036854775807ll\n"
+ "#define ULLONG_MAX (LLONG_MAX * 2ull + 1ull)\n"
+#else
"#define LONG_MIN (-LONG_MAX - 1l)\n"
"#define LONG_MAX 9223372036854775807l\n"
"#define ULONG_MAX (LONG_MAX * 2ul + 1ul)\n"
"\n"
- "#define LLONG_MIN LONG_MIN\n"
- "#define LLONG_MAX LONG_MAX\n"
- "#define ULLONG_MAX ULONG_MAX\n"
+ "#define LLONG_MIN (-LLONG_MAX - 1ll)\n"
+ "#define LLONG_MAX 9223372036854775807ll\n"
+ "#define ULLONG_MAX (LLONG_MAX * 2ull + 1ull)\n"
+#endif
"\n"
"/* signed char by default */\n"
"#define CHAR_MIN SCHAR_MIN\n"
