]>
Commit | Line | Data |
---|---|---|
ffb96c09 EA |
1 | /* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | |
64bc6412 | 3 | |
ffb96c09 EA |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | License, or (at your option) any later version. | |
64bc6412 | 8 | |
ffb96c09 EA |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Library General Public License for more details. | |
64bc6412 | 13 | |
ffb96c09 EA |
14 | You should have received a copy of the GNU Library General Public |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
64bc6412 EA |
18 | |
19 | /* | |
ffb96c09 | 20 | * ISO C Standard: 4.14/2.2.4.2 Limits of integral types <limits.h> |
64bc6412 EA |
21 | */ |
22 | ||
ffb96c09 EA |
23 | #ifndef _LIBC_LIMITS_H_ |
24 | #define _LIBC_LIMITS_H_ 1 | |
64bc6412 | 25 | |
64bc6412 EA |
26 | #include <features.h> |
27 | ||
28 | #ifdef __USE_POSIX | |
29 | /* POSIX adds things to <limits.h>. */ | |
ffb96c09 | 30 | # include <bits/posix1_lim.h> |
64bc6412 EA |
31 | #endif |
32 | ||
33 | #ifdef __USE_POSIX2 | |
ffb96c09 | 34 | # include <bits/posix2_lim.h> |
64bc6412 EA |
35 | #endif |
36 | ||
ffb96c09 EA |
37 | #ifdef __USE_XOPEN |
38 | # include <bits/xopen_lim.h> | |
39 | #endif | |
40 | ||
41 | ||
42 | /* Maximum length of any multibyte character in any locale. | |
43 | We define this value here since the gcc header does not define | |
44 | the correct value. */ | |
45 | #define MB_LEN_MAX 6 | |
64bc6412 | 46 | |
64bc6412 | 47 | |
ffb96c09 EA |
48 | /* We only protect from multiple inclusion here, because all the other |
49 | #include's protect themselves, and in GCC 2 we may #include_next through | |
50 | multiple copies of this file before we get to GCC's. */ | |
51 | # ifndef _LIMITS_H | |
52 | # define _LIMITS_H 1 | |
64bc6412 EA |
53 | |
54 | /* We don't have #include_next. | |
55 | Define ANSI <limits.h> for standard 32-bit words. */ | |
56 | ||
57 | /* These assume 8-bit `char's, 16-bit `short int's, | |
58 | and 32-bit `int's and `long int's. */ | |
59 | ||
60 | /* Number of bits in a `char'. */ | |
ffb96c09 | 61 | # define CHAR_BIT 8 |
64bc6412 EA |
62 | |
63 | /* Minimum and maximum values a `signed char' can hold. */ | |
ffb96c09 EA |
64 | # define SCHAR_MIN (-128) |
65 | # define SCHAR_MAX 127 | |
64bc6412 EA |
66 | |
67 | /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ | |
ffb96c09 | 68 | # define UCHAR_MAX 255 |
64bc6412 EA |
69 | |
70 | /* Minimum and maximum values a `char' can hold. */ | |
ffb96c09 EA |
71 | # ifdef __CHAR_UNSIGNED__ |
72 | # define CHAR_MIN 0 | |
73 | # define CHAR_MAX UCHAR_MAX | |
74 | # else | |
75 | # define CHAR_MIN SCHAR_MIN | |
76 | # define CHAR_MAX SCHAR_MAX | |
77 | # endif | |
64bc6412 EA |
78 | |
79 | /* Minimum and maximum values a `signed short int' can hold. */ | |
ffb96c09 EA |
80 | # define SHRT_MIN (-32768) |
81 | # define SHRT_MAX 32767 | |
64bc6412 EA |
82 | |
83 | /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ | |
ffb96c09 | 84 | # define USHRT_MAX 65535 |
64bc6412 EA |
85 | |
86 | /* Minimum and maximum values a `signed int' can hold. */ | |
ffb96c09 EA |
87 | # define INT_MIN (-INT_MAX - 1) |
88 | # define INT_MAX 2147483647 | |
64bc6412 EA |
89 | |
90 | /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ | |
ffb96c09 EA |
91 | # ifdef __STDC__ |
92 | # define UINT_MAX 4294967295U | |
93 | # else | |
94 | # define UINT_MAX 4294967295 | |
95 | # endif | |
64bc6412 EA |
96 | |
97 | /* Minimum and maximum values a `signed long int' can hold. */ | |
ffb96c09 EA |
98 | # ifdef __alpha__ |
99 | # define LONG_MAX 9223372036854775807L | |
100 | # else | |
101 | # define LONG_MAX 2147483647L | |
102 | # endif | |
103 | # define LONG_MIN (-LONG_MAX - 1L) | |
64bc6412 EA |
104 | |
105 | /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */ | |
ffb96c09 EA |
106 | # ifdef __alpha__ |
107 | # define ULONG_MAX 18446744073709551615UL | |
108 | # else | |
109 | # ifdef __STDC__ | |
110 | # define ULONG_MAX 4294967295UL | |
111 | # else | |
112 | # define ULONG_MAX 4294967295L | |
113 | # endif | |
114 | # endif | |
115 | ||
116 | # endif /* limits.h */ | |
64bc6412 | 117 | |
ffb96c09 | 118 | #endif /* !_LIBC_LIMITS_H_ */ |
64bc6412 | 119 | |
ffb96c09 | 120 | /* Get the compiler's limits.h, which defines almost all the ISO constants. |
64bc6412 | 121 | |
ffb96c09 EA |
122 | We put this #include_next outside the double inclusion check because |
123 | it should be possible to include this file more than once and still get | |
124 | the definitions from gcc's header. */ | |
125 | #if defined __GNUC__ && !defined _GCC_LIMITS_H_ | |
126 | /* `_GCC_LIMITS_H_' is what GCC's file defines. */ | |
127 | # include_next <limits.h> | |
128 | #endif |