1 /* Copyright (C) 1991 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
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * ANSI Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
29 /* POSIX adds things to <limits.h>. */
30 #include <posix1_lim.h>
34 #include <posix2_lim.h>
37 /* These assume 8-bit `char's, 16-bit `short int's,
38 and 32-bit `int's and `long int's. */
40 /* Number of bits in a `char'. */
43 /* Maximum length of any multibyte character in any locale.
44 Locale-writers should change this as necessary. */
47 /* Minimum and maximum values a `signed char' can hold. */
48 #define SCHAR_MIN (-128)
51 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
53 #define UCHAR_MAX 255U
58 /* Minimum and maximum values a `char' can hold. */
59 #ifdef __CHAR_UNSIGNED__
61 #define CHAR_MAX UCHAR_MAX
63 #define CHAR_MIN SCHAR_MIN
64 #define CHAR_MAX SCHAR_MAX
67 /* Minimum and maximum values a `signed short int' can hold. */
68 #define SHRT_MIN (-32768)
69 #define SHRT_MAX 32767
71 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
72 #define USHRT_MAX 65535
74 /* Minimum and maximum values a `signed int' can hold. */
75 #define INT_MIN (- INT_MAX - 1)
76 #define INT_MAX 2147483647
78 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
80 #define UINT_MAX 4294967295U
82 #define UINT_MAX 4294967295
85 /* Minimum and maximum values a `signed long int' can hold. */
86 #define LONG_MIN INT_MIN
87 #define LONG_MAX INT_MAX
89 /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
90 #define ULONG_MAX UINT_MAX