2010-11-24 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / glimits.h
blobdbefb1dfcc6018b433d87ef198cb8c330c9fb2b6
1 /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001,
2 2002 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
25 #ifndef _LIMITS_H___
26 #define _LIMITS_H___
28 /* Number of bits in a `char'. */
29 #undef CHAR_BIT
30 #define CHAR_BIT __CHAR_BIT__
32 /* Maximum length of a multibyte character. */
33 #ifndef MB_LEN_MAX
34 #define MB_LEN_MAX 1
35 #endif
37 /* Minimum and maximum values a `signed char' can hold. */
38 #undef SCHAR_MIN
39 #define SCHAR_MIN (-SCHAR_MAX - 1)
40 #undef SCHAR_MAX
41 #define SCHAR_MAX __SCHAR_MAX__
43 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
44 #undef UCHAR_MAX
45 #if __SCHAR_MAX__ == __INT_MAX__
46 # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
47 #else
48 # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
49 #endif
51 /* Minimum and maximum values a `char' can hold. */
52 #ifdef __CHAR_UNSIGNED__
53 # undef CHAR_MIN
54 # if __SCHAR_MAX__ == __INT_MAX__
55 # define CHAR_MIN 0U
56 # else
57 # define CHAR_MIN 0
58 # endif
59 # undef CHAR_MAX
60 # define CHAR_MAX UCHAR_MAX
61 #else
62 # undef CHAR_MIN
63 # define CHAR_MIN SCHAR_MIN
64 # undef CHAR_MAX
65 # define CHAR_MAX SCHAR_MAX
66 #endif
68 /* Minimum and maximum values a `signed short int' can hold. */
69 #undef SHRT_MIN
70 #define SHRT_MIN (-SHRT_MAX - 1)
71 #undef SHRT_MAX
72 #define SHRT_MAX __SHRT_MAX__
74 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
75 #undef USHRT_MAX
76 #if __SHRT_MAX__ == __INT_MAX__
77 # define USHRT_MAX (SHRT_MAX * 2U + 1U)
78 #else
79 # define USHRT_MAX (SHRT_MAX * 2 + 1)
80 #endif
82 /* Minimum and maximum values a `signed int' can hold. */
83 #undef INT_MIN
84 #define INT_MIN (-INT_MAX - 1)
85 #undef INT_MAX
86 #define INT_MAX __INT_MAX__
88 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
89 #undef UINT_MAX
90 #define UINT_MAX (INT_MAX * 2U + 1U)
92 /* Minimum and maximum values a `signed long int' can hold.
93 (Same as `int'). */
94 #undef LONG_MIN
95 #define LONG_MIN (-LONG_MAX - 1L)
96 #undef LONG_MAX
97 #define LONG_MAX __LONG_MAX__
99 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
100 #undef ULONG_MAX
101 #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
103 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
104 /* Minimum and maximum values a `signed long long int' can hold. */
105 # undef LLONG_MIN
106 # define LLONG_MIN (-LLONG_MAX - 1LL)
107 # undef LLONG_MAX
108 # define LLONG_MAX __LONG_LONG_MAX__
110 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
111 # undef ULLONG_MAX
112 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
113 #endif
115 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
116 /* Minimum and maximum values a `signed long long int' can hold. */
117 # undef LONG_LONG_MIN
118 # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
119 # undef LONG_LONG_MAX
120 # define LONG_LONG_MAX __LONG_LONG_MAX__
122 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
123 # undef ULONG_LONG_MAX
124 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
125 #endif
127 #endif /* _LIMITS_H___ */