Fixed stuff for ISO-compliance (& mb_len_max)

This commit is contained in:
Kat R. 2022-05-28 15:45:11 -05:00
parent eb41275b1c
commit 98a53fc774

View file

@ -125,22 +125,38 @@
#endif
/* Numerical limits as defined in the ISO C standard */
/* Shorts (Defined as 16-bit) */
/* Numerical limits */
/* Shorts (16-bit in both ISO and POSIX) */
#define SHRT_MAX 32767
#define SHRT_MIN -32767
#define USHRT_MAX 65535
/* Integers (Defined as 32-bit here) */
/* Integers */
#ifdef _POSIX_C_SOURCE
/* If we're POSIX, int is 32-bit */
#define WORD_BIT 32
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define UINT_MAX 4294967295U
/* Long ints (Defined as 64-bit) */
#else
/* If we're not POSIX, int is only 16-bit, for some reason. */
#define INT_MAX 32767
#define INT_MIN -32767
#define UINT_MAX 65535U
#endif
/* Long ints */
#ifdef _POSIX_C_SOURCE
/* If we're POSIX, long is 64-bit */
#define LONG_BIT 64
#define LONG_MAX 9223372036854775807LL
#define LONG_MIN -9223372036854775808LL
#define ULONG_MAX 18446744073709551615ULL
/* Long long ints (Also defined as 64-bit) */
#define LONG_MAX 9223372036854775807L
#define LONG_MIN -9223372036854775808L
#define ULONG_MAX 18446744073709551615UL
#else
/* If we're not POSIX, long is only 32-bit */
#define LONG_MAX 2147483647L
#define LONG_MIN -2147483647L
#define ULONG_MAX 4294967295UL
#endif
/* Long long ints (64-bit in both ISO and POSIX) */
#define LLONG_MAX 9223372036854775807LL
#define LLONG_MIN -9223372036854775808LL
#define ULLONG_MAX 18446744073709551615ULL
@ -156,10 +172,6 @@
#define SCHAR_MAX 127
#define SCHAR_MIN -128
#define UCHAR_MAX 255
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
#define MB_LEN_MAX 4
#else
#define MB_LEN_MAX 1
#endif
#endif /* ndef _FLC_LIMITS */