1 /* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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. */
20 * ISO C Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
23 #ifndef _LIBC_LIMITS_H_
24 #define _LIBC_LIMITS_H_ 1
29 /* POSIX adds things to <limits.h>. */
30 # include <bits/posix1_lim.h>
34 # include <bits/posix2_lim.h>
38 # include <bits/xopen_lim.h>
42 /* Maximum length of any multibyte character in any locale.
43 We define this value here since the gcc header does not define
48 /* If we are not using GNU CC we have to define all the symbols ourself.
49 Otherwise use gcc's definitions (see below). */
50 #if !defined __GNUC__ || __GNUC__ < 2
52 /* We only protect from multiple inclusion here, because all the other
53 #include's protect themselves, and in GCC 2 we may #include_next through
54 multiple copies of this file before we get to GCC's. */
58 /* We don't have #include_next.
59 Define ANSI <limits.h> for standard 32-bit words. */
61 /* These assume 8-bit `char's, 16-bit `short int's,
62 and 32-bit `int's and `long int's. */
64 /* Number of bits in a `char'. */
67 /* Minimum and maximum values a `signed char' can hold. */
68 # define SCHAR_MIN (-128)
69 # define SCHAR_MAX 127
71 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
72 # define UCHAR_MAX 255
74 /* Minimum and maximum values a `char' can hold. */
75 # ifdef __CHAR_UNSIGNED__
77 # define CHAR_MAX UCHAR_MAX
79 # define CHAR_MIN SCHAR_MIN
80 # define CHAR_MAX SCHAR_MAX
83 /* Minimum and maximum values a `signed short int' can hold. */
84 # define SHRT_MIN (-32768)
85 # define SHRT_MAX 32767
87 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
88 # define USHRT_MAX 65535
90 /* Minimum and maximum values a `signed int' can hold. */
91 # define INT_MIN (-INT_MAX - 1)
92 # define INT_MAX 2147483647
94 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
95 # define UINT_MAX 4294967295U
97 /* Minimum and maximum values a `signed long int' can hold. */
99 # define LONG_MAX 9223372036854775807L
101 # define LONG_MAX 2147483647L
103 # define LONG_MIN (-LONG_MAX - 1L)
105 /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
107 # define ULONG_MAX 18446744073709551615UL
109 # define ULONG_MAX 4294967295UL
114 /* Minimum and maximum values a `signed long long int' can hold. */
115 # define LLONG_MAX 9223372036854775807LL
116 # define LLONG_MIN (-LLONG_MAX - 1LL)
118 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */
119 # define ULLONG_MAX 18446744073709551615ULL
121 # endif /* ISO C99 */
123 # endif /* limits.h */
126 #endif /* !_LIBC_LIMITS_H_ */
128 /* Get the compiler's limits.h, which defines almost all the ISO constants.
130 We put this #include_next outside the double inclusion check because
131 it should be possible to include this file more than once and still get
132 the definitions from gcc's header. */
133 #if defined __GNUC__ && !defined _GCC_LIMITS_H_
134 /* `_GCC_LIMITS_H_' is what GCC's file defines. */
135 # include_next <limits.h>