mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
868af3f950
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.
90 lines
2.6 KiB
C
90 lines
2.6 KiB
C
#ifndef COSMOPOLITAN_LIBC_LIMITS_H_
|
|
#define COSMOPOLITAN_LIBC_LIMITS_H_
|
|
#define __STDC_LIMIT_MACROS
|
|
|
|
#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
|
|
|
|
#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__
|
|
#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__
|
|
#define INTMAX_MAX __INTMAX_MAX__
|
|
#define UINTMAX_MAX __UINTMAX_MAX__
|
|
|
|
#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)
|
|
|
|
#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
|
|
|
|
#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
|
|
#define UINTMAX_MIN ((uintmax_t)0)
|
|
|
|
#define MB_CUR_MAX 4
|
|
#define MB_LEN_MAX 4
|
|
|
|
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 406 || defined(__llvm__)
|
|
#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)
|
|
#endif /* GCC 4.6+ */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_LIMITS_H_ */
|