1 /* Copyright (C) 1991-2019 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 3, or (at your option) any later
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
27 /* Number of bits in a `char'. */
29 #define CHAR_BIT __CHAR_BIT__
31 /* Maximum length of a multibyte character. */
36 /* Minimum and maximum values a `signed char' can hold. */
38 #define SCHAR_MIN (-SCHAR_MAX - 1)
40 #define SCHAR_MAX __SCHAR_MAX__
42 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
44 #if __SCHAR_MAX__ == __INT_MAX__
45 # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
47 # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
50 /* Minimum and maximum values a `char' can hold. */
51 #ifdef __CHAR_UNSIGNED__
53 # if __SCHAR_MAX__ == __INT_MAX__
59 # define CHAR_MAX UCHAR_MAX
62 # define CHAR_MIN SCHAR_MIN
64 # define CHAR_MAX SCHAR_MAX
67 /* Minimum and maximum values a `signed short int' can hold. */
69 #define SHRT_MIN (-SHRT_MAX - 1)
71 #define SHRT_MAX __SHRT_MAX__
73 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
75 #if __SHRT_MAX__ == __INT_MAX__
76 # define USHRT_MAX (SHRT_MAX * 2U + 1U)
78 # define USHRT_MAX (SHRT_MAX * 2 + 1)
81 /* Minimum and maximum values a `signed int' can hold. */
83 #define INT_MIN (-INT_MAX - 1)
85 #define INT_MAX __INT_MAX__
87 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
89 #define UINT_MAX (INT_MAX * 2U + 1U)
91 /* Minimum and maximum values a `signed long int' can hold.
94 #define LONG_MIN (-LONG_MAX - 1L)
96 #define LONG_MAX __LONG_MAX__
98 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
100 #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
102 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
103 /* Minimum and maximum values a `signed long long int' can hold. */
105 # define LLONG_MIN (-LLONG_MAX - 1LL)
107 # define LLONG_MAX __LONG_LONG_MAX__
109 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
111 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
114 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
115 /* Minimum and maximum values a `signed long long int' can hold. */
116 # undef LONG_LONG_MIN
117 # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
118 # undef LONG_LONG_MAX
119 # define LONG_LONG_MAX __LONG_LONG_MAX__
121 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
122 # undef ULONG_LONG_MAX
123 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
126 #ifdef __STDC_WANT_IEC_60559_BFP_EXT__
127 /* TS 18661-1 widths of integer types. */
129 # define CHAR_WIDTH __SCHAR_WIDTH__
131 # define SCHAR_WIDTH __SCHAR_WIDTH__
133 # define UCHAR_WIDTH __SCHAR_WIDTH__
135 # define SHRT_WIDTH __SHRT_WIDTH__
137 # define USHRT_WIDTH __SHRT_WIDTH__
139 # define INT_WIDTH __INT_WIDTH__
141 # define UINT_WIDTH __INT_WIDTH__
143 # define LONG_WIDTH __LONG_WIDTH__
145 # define ULONG_WIDTH __LONG_WIDTH__
147 # define LLONG_WIDTH __LONG_LONG_WIDTH__
149 # define ULLONG_WIDTH __LONG_LONG_WIDTH__
152 #endif /* _LIMITS_H___ */