1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 */ 5 #ifndef LIMITS_H 6 #define LIMITS_H 7 8 #define CHAR_BIT __CHAR_BIT__ 9 10 #ifdef __CHAR_UNSIGNED__ 11 #define CHAR_MAX UCHAR_MAX 12 #define CHAR_MIN 0 13 #else 14 #define CHAR_MAX SCHAR_MAX 15 #define CHAR_MIN SCHAR_MIN 16 #endif 17 18 #define INT_MAX __INT_MAX__ 19 #define INT_MIN (-INT_MAX - 1) 20 21 #define LONG_MAX __LONG_MAX__ 22 #define LONG_MIN (-LONG_MAX - 1L) 23 24 #define LLONG_MAX __LONG_LONG_MAX__ 25 #define LLONG_MIN (-LLONG_MAX - 1LL) 26 27 #define MB_LEN_MAX 1 28 29 #define SCHAR_MAX __SCHAR_MAX__ 30 #define SCHAR_MIN (-SCHAR_MAX - 1) 31 32 #define SHRT_MAX __SHRT_MAX__ 33 #define SHRT_MIN (-SHRT_MAX - 1) 34 35 #if __SCHAR_MAX__ == __INT_MAX__ 36 #define UCHAR_MAX (SCHAR_MAX * 2U + 1U) 37 #else 38 #define UCHAR_MAX (SCHAR_MAX * 2 + 1) 39 #endif 40 41 #if __SHRT_MAX__ == __INT_MAX__ 42 #define USHRT_MAX (SHRT_MAX * 2U + 1U) 43 #else 44 #define USHRT_MAX (SHRT_MAX * 2 + 1) 45 #endif 46 47 #define UINT_MAX (INT_MAX * 2U + 1U) 48 49 #define ULONG_MAX (LONG_MAX * 2UL + 1UL) 50 #define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) 51 52 #endif /* LIMITS_H */ 53