2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_LIMITS_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_LIMITS_H_
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
#define __STDC_LIMIT_MACROS
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-03-01 04:59:19 +00:00
|
|
|
#define UCHAR_MIN 0
|
|
|
|
#define UCHAR_MAX 255
|
|
|
|
|
|
|
|
#if '\200' < 0
|
|
|
|
#define CHAR_MIN '\200'
|
|
|
|
#define CHAR_MAX '\177'
|
|
|
|
#else
|
|
|
|
#define CHAR_MIN '\0'
|
|
|
|
#define CHAR_MAX '\377'
|
|
|
|
#endif
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
#define SCHAR_MAX __SCHAR_MAX__
|
|
|
|
#define SHRT_MAX __SHRT_MAX__
|
|
|
|
#define INT_MAX __INT_MAX__
|
|
|
|
#define LONG_MAX __LONG_MAX__
|
|
|
|
#define LLONG_MAX LONG_LONG_MAX
|
|
|
|
#define LONG_LONG_MAX __LONG_LONG_MAX__
|
|
|
|
#define SIZE_MAX __SIZE_MAX__
|
|
|
|
#define INT8_MAX __INT8_MAX__
|
|
|
|
#define INT16_MAX __INT16_MAX__
|
|
|
|
#define INT32_MAX __INT32_MAX__
|
|
|
|
#define INT64_MAX __INT64_MAX__
|
|
|
|
#define WINT_MAX __WCHAR_MAX__
|
|
|
|
#define WCHAR_MAX __WCHAR_MAX__
|
|
|
|
#define INTPTR_MAX __INTPTR_MAX__
|
|
|
|
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
2021-03-01 04:59:19 +00:00
|
|
|
#define UINTPTR_MAX __UINTPTR_MAX__
|
|
|
|
#define UINT8_MAX __UINT8_MAX__
|
|
|
|
#define UINT16_MAX __UINT16_MAX__
|
|
|
|
#define UINT32_MAX __UINT32_MAX__
|
|
|
|
#define UINT64_MAX __UINT64_MAX__
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
#define INTMAX_MAX __INTMAX_MAX__
|
|
|
|
#define UINTMAX_MAX __UINTMAX_MAX__
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-03-01 04:59:19 +00:00
|
|
|
#define SCHAR_MIN (-SCHAR_MAX - 1)
|
|
|
|
#define SHRT_MIN (-SHRT_MAX - 1)
|
|
|
|
#define INT_MIN (-INT_MAX - 1)
|
|
|
|
#define LONG_MIN (-LONG_MAX - 1)
|
|
|
|
#define LLONG_MIN (-LLONG_MAX - 1)
|
|
|
|
#define LONG_LONG_MIN (-LONG_LONG_MAX - 1)
|
|
|
|
#define SIZE_MIN (-SIZE_MAX - 1)
|
|
|
|
#define INT8_MIN (-INT8_MAX - 1)
|
|
|
|
#define INT16_MIN (-INT16_MAX - 1)
|
|
|
|
#define INT32_MIN (-INT32_MAX - 1)
|
|
|
|
#define INT64_MIN (-INT64_MAX - 1)
|
|
|
|
#define INTMAX_MIN (-INTMAX_MAX - 1)
|
|
|
|
#define INTPTR_MIN (-INTPTR_MAX - 1)
|
|
|
|
#define WINT_MIN (-WINT_MAX - 1)
|
|
|
|
#define WCHAR_MIN (-WCHAR_MAX - 1)
|
|
|
|
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-03-01 04:59:19 +00:00
|
|
|
#define USHRT_MAX 65535
|
|
|
|
#define UINT_MAX 0xffffffffu
|
|
|
|
#if __SIZEOF_LONG__ == 8
|
|
|
|
#define ULONG_MAX 0xfffffffffffffffful
|
|
|
|
#else
|
|
|
|
#define ULONG_MAX 0xfffffffful
|
|
|
|
#endif
|
|
|
|
#define ULLONG_MAX 0xffffffffffffffffull
|
|
|
|
#define ULONG_LONG_MAX 0xffffffffffffffffull
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-03-01 04:59:19 +00:00
|
|
|
#define USHRT_MIN 0
|
|
|
|
#define UINT_MIN 0u
|
|
|
|
#define ULONG_MIN 0ul
|
|
|
|
#define ULLONG_MIN 0ull
|
|
|
|
#define ULONG_LONG_MIN 0ull
|
|
|
|
#define UINT8_MIN 0
|
|
|
|
#define UINT16_MIN 0
|
|
|
|
#define UINT32_MIN 0u
|
|
|
|
#define UINT64_MIN 0ull
|
|
|
|
#define UINTPTR_MIN 0ull
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
#define UINTMAX_MIN ((uintmax_t)0)
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-03-06 17:52:29 +00:00
|
|
|
#define MB_CUR_MAX 4
|
|
|
|
#define MB_LEN_MAX 4
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 406 || defined(__llvm__)
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
#define INT128_MIN (-INT128_MAX - 1)
|
|
|
|
#define UINT128_MIN ((uint128_t)0)
|
|
|
|
#define INT128_MAX \
|
|
|
|
((int128_t)0x7fffffffffffffff << 64 | (int128_t)0xffffffffffffffff)
|
|
|
|
#define UINT128_MAX \
|
|
|
|
((uint128_t)0xffffffffffffffff << 64 | (uint128_t)0xffffffffffffffff)
|
2020-06-15 14:18:57 +00:00
|
|
|
#endif /* GCC 4.6+ */
|
|
|
|
|
2022-09-06 14:04:13 +00:00
|
|
|
#define SIG_ATOMIC_MIN INT32_MIN
|
|
|
|
#define SIG_ATOMIC_MAX INT32_MAX
|
|
|
|
|
2022-09-06 18:22:08 +00:00
|
|
|
#define FILESIZEBITS 64
|
|
|
|
#define SYMLOOP_MAX 40
|
|
|
|
#define TTY_NAME_MAX 32
|
|
|
|
#define HOST_NAME_MAX 255
|
|
|
|
#define TZNAME_MAX 6
|
|
|
|
#define WORD_BIT 32
|
|
|
|
#define SEM_VALUE_MAX 0x7fffffff
|
|
|
|
#define SEM_NSEMS_MAX 256
|
|
|
|
#define DELAYTIMER_MAX 0x7fffffff
|
|
|
|
#define MQ_PRIO_MAX 32768
|
|
|
|
#define LOGIN_NAME_MAX 256
|
|
|
|
|
|
|
|
#define NL_ARGMAX 9
|
|
|
|
#define NL_MSGMAX 32767
|
|
|
|
#define NL_SETMAX 255
|
|
|
|
#define NL_TEXTMAX 2048
|
|
|
|
|
2022-09-12 11:19:32 +00:00
|
|
|
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
|
|
|
|
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
|
|
|
|
#define INT_FAST32_MAX __INT_FAST32_MAX__
|
|
|
|
#define INT_FAST16_MAX __INT_FAST16_MAX__
|
|
|
|
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
|
|
|
|
#define INT_FAST8_MAX __INT_FAST8_MAX__
|
|
|
|
#define INT_FAST64_MAX __INT_FAST64_MAX__
|
|
|
|
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
|
|
|
|
|
|
|
|
#define UINT_FAST64_MIN (-UINT_FAST64_MAX - 1)
|
|
|
|
#define UINT_FAST8_MIN (-UINT_FAST8_MAX - 1)
|
|
|
|
#define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
|
|
|
|
#define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
|
|
|
|
#define UINT_FAST32_MIN (-UINT_FAST32_MAX - 1)
|
|
|
|
#define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
|
|
|
|
#define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
|
|
|
|
#define UINT_FAST16_MIN (-UINT_FAST16_MAX - 1)
|
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
#endif /* COSMOPOLITAN_LIBC_LIMITS_H_ */
|