2008-05-15 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / glimits.h
blob710cbb528abbeba2bbb32bd0dcbf9c71f2e865a3
1 #ifndef _LIMITS_H___
2 #define _LIMITS_H___
4 /* Number of bits in a `char'. */
5 #undef CHAR_BIT
6 #define CHAR_BIT __CHAR_BIT__
8 /* Maximum length of a multibyte character. */
9 #ifndef MB_LEN_MAX
10 #define MB_LEN_MAX 1
11 #endif
13 /* Minimum and maximum values a `signed char' can hold. */
14 #undef SCHAR_MIN
15 #define SCHAR_MIN (-SCHAR_MAX - 1)
16 #undef SCHAR_MAX
17 #define SCHAR_MAX __SCHAR_MAX__
19 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
20 #undef UCHAR_MAX
21 #if __SCHAR_MAX__ == __INT_MAX__
22 # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
23 #else
24 # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
25 #endif
27 /* Minimum and maximum values a `char' can hold. */
28 #ifdef __CHAR_UNSIGNED__
29 # undef CHAR_MIN
30 # if __SCHAR_MAX__ == __INT_MAX__
31 # define CHAR_MIN 0U
32 # else
33 # define CHAR_MIN 0
34 # endif
35 # undef CHAR_MAX
36 # define CHAR_MAX UCHAR_MAX
37 #else
38 # undef CHAR_MIN
39 # define CHAR_MIN SCHAR_MIN
40 # undef CHAR_MAX
41 # define CHAR_MAX SCHAR_MAX
42 #endif
44 /* Minimum and maximum values a `signed short int' can hold. */
45 #undef SHRT_MIN
46 #define SHRT_MIN (-SHRT_MAX - 1)
47 #undef SHRT_MAX
48 #define SHRT_MAX __SHRT_MAX__
50 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
51 #undef USHRT_MAX
52 #if __SHRT_MAX__ == __INT_MAX__
53 # define USHRT_MAX (SHRT_MAX * 2U + 1U)
54 #else
55 # define USHRT_MAX (SHRT_MAX * 2 + 1)
56 #endif
58 /* Minimum and maximum values a `signed int' can hold. */
59 #undef INT_MIN
60 #define INT_MIN (-INT_MAX - 1)
61 #undef INT_MAX
62 #define INT_MAX __INT_MAX__
64 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
65 #undef UINT_MAX
66 #define UINT_MAX (INT_MAX * 2U + 1U)
68 /* Minimum and maximum values a `signed long int' can hold.
69 (Same as `int'). */
70 #undef LONG_MIN
71 #define LONG_MIN (-LONG_MAX - 1L)
72 #undef LONG_MAX
73 #define LONG_MAX __LONG_MAX__
75 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
76 #undef ULONG_MAX
77 #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
79 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
80 /* Minimum and maximum values a `signed long long int' can hold. */
81 # undef LLONG_MIN
82 # define LLONG_MIN (-LLONG_MAX - 1LL)
83 # undef LLONG_MAX
84 # define LLONG_MAX __LONG_LONG_MAX__
86 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
87 # undef ULLONG_MAX
88 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
89 #endif
91 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
92 /* Minimum and maximum values a `signed long long int' can hold. */
93 # undef LONG_LONG_MIN
94 # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
95 # undef LONG_LONG_MAX
96 # define LONG_LONG_MAX __LONG_LONG_MAX__
98 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
99 # undef ULONG_LONG_MAX
100 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
101 #endif
103 #endif /* _LIMITS_H___ */