blob: ec83068d7e6fa1b7bffb61a3a18ff132263d35ad [file] [log] [blame]
Chandan Uddarajuf72ce812009-11-21 10:31:02 -08001/* This administrivia gets added to the beginning of limits.h
2 if the system has its own version of limits.h. */
3
4/* We use _GCC_LIMITS_H_ because we want this not to match
5 any macros that the system's limits.h uses for its own purposes. */
6#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
7#define _GCC_LIMITS_H_
8
9#ifndef _LIMITS_H___
10#define _LIMITS_H___
11
12/* Number of bits in a `char'. */
13#undef CHAR_BIT
14#define CHAR_BIT __CHAR_BIT__
15
16/* Maximum length of a multibyte character. */
17#ifndef MB_LEN_MAX
18#define MB_LEN_MAX 1
19#endif
20
21/* Minimum and maximum values a `signed char' can hold. */
22#undef SCHAR_MIN
23#define SCHAR_MIN (-SCHAR_MAX - 1)
24#undef SCHAR_MAX
25#define SCHAR_MAX __SCHAR_MAX__
26
27/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
28#undef UCHAR_MAX
29#if __SCHAR_MAX__ == __INT_MAX__
30# define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
31#else
32# define UCHAR_MAX (SCHAR_MAX * 2 + 1)
33#endif
34
35/* Minimum and maximum values a `char' can hold. */
36#ifdef __CHAR_UNSIGNED__
37# undef CHAR_MIN
38# if __SCHAR_MAX__ == __INT_MAX__
39# define CHAR_MIN 0U
40# else
41# define CHAR_MIN 0
42# endif
43# undef CHAR_MAX
44# define CHAR_MAX UCHAR_MAX
45#else
46# undef CHAR_MIN
47# define CHAR_MIN SCHAR_MIN
48# undef CHAR_MAX
49# define CHAR_MAX SCHAR_MAX
50#endif
51
52/* Minimum and maximum values a `signed short int' can hold. */
53#undef SHRT_MIN
54#define SHRT_MIN (-SHRT_MAX - 1)
55#undef SHRT_MAX
56#define SHRT_MAX __SHRT_MAX__
57
58/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
59#undef USHRT_MAX
60#if __SHRT_MAX__ == __INT_MAX__
61# define USHRT_MAX (SHRT_MAX * 2U + 1U)
62#else
63# define USHRT_MAX (SHRT_MAX * 2 + 1)
64#endif
65
66/* Minimum and maximum values a `signed int' can hold. */
67#undef INT_MIN
68#define INT_MIN (-INT_MAX - 1)
69#undef INT_MAX
70#define INT_MAX __INT_MAX__
71
72/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
73#undef UINT_MAX
74#define UINT_MAX (INT_MAX * 2U + 1U)
75
76/* Minimum and maximum values a `signed long int' can hold.
77 (Same as `int'). */
78#undef LONG_MIN
79#define LONG_MIN (-LONG_MAX - 1L)
80#undef LONG_MAX
81#define LONG_MAX __LONG_MAX__
82
83/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
84#undef ULONG_MAX
85#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
86
87#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
88/* Minimum and maximum values a `signed long long int' can hold. */
89# undef LLONG_MIN
90# define LLONG_MIN (-LLONG_MAX - 1LL)
91# undef LLONG_MAX
92# define LLONG_MAX __LONG_LONG_MAX__
93
94/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
95# undef ULLONG_MAX
96# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
97#endif
98
99#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
100/* Minimum and maximum values a `signed long long int' can hold. */
101# undef LONG_LONG_MIN
102# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
103# undef LONG_LONG_MAX
104# define LONG_LONG_MAX __LONG_LONG_MAX__
105
106/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
107# undef ULONG_LONG_MAX
108# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
109#endif
110
111#endif /* _LIMITS_H___ */
112/* This administrivia gets added to the end of limits.h
113 if the system has its own version of limits.h. */
114
115#else /* not _GCC_LIMITS_H_ */
116
117#ifdef _GCC_NEXT_LIMITS_H
118#include_next <limits.h> /* recurse down to the real one */
119#endif
120
121#endif /* not _GCC_LIMITS_H_ */