Update.
[platform/upstream/glibc.git] / limits.h
1 /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
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.
8
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.
13
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.  */
18
19 /*
20  *      ISO C Standard: 4.14/2.2.4.2 Limits of integral types   <limits.h>
21  */
22
23 #include <features.h>
24
25 #ifdef  __USE_POSIX
26 /* POSIX adds things to <limits.h>.  */
27 # include <posix1_lim.h>
28 #endif
29
30 #ifdef  __USE_POSIX2
31 # include <posix2_lim.h>
32 #endif
33
34 #ifdef  __USE_XOPEN
35 # include <xopen_lim.h>
36 #endif
37
38
39 #if     __GNUC__ >= 2
40
41  /* Get the compiler's limits.h, which defines all the ANSI constants.  */
42  #ifndef _LIBC_LIMITS_H_
43  #define _LIBC_LIMITS_H_        /* This tells it not to look for another.  */
44  #endif
45  #ifndef _GCC_LIMITS_H_         /* This is what GCC's file defines.  */
46  #include_next <limits.h>
47  #endif
48
49 #else   /* Not GCC 2.  */
50
51 /* We only protect from multiple inclusion here, because all the other
52    #include's protect themselves, and in GCC 2 we may #include_next through
53    multiple copies of this file before we get to GCC's.  */
54 # ifndef _LIMITS_H
55 #  define _LIMITS_H     1
56
57 /* We don't have #include_next.
58    Define ANSI <limits.h> for standard 32-bit words.  */
59
60 /* These assume 8-bit `char's, 16-bit `short int's,
61    and 32-bit `int's and `long int's.  */
62
63 /* Number of bits in a `char'.  */
64 #  define CHAR_BIT      8
65
66 /* Maximum length of any multibyte character in any locale.  */
67 #  define MB_LEN_MAX    6
68
69 /* Minimum and maximum values a `signed char' can hold.  */
70 #  define SCHAR_MIN     (-128)
71 #  define SCHAR_MAX     127
72
73 /* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
74 #  define UCHAR_MAX     255
75
76 /* Minimum and maximum values a `char' can hold.  */
77 #  ifdef __CHAR_UNSIGNED__
78 #   define CHAR_MIN     0
79 #   define CHAR_MAX     UCHAR_MAX
80 #  else
81 #   define CHAR_MIN     SCHAR_MIN
82 #   define CHAR_MAX     SCHAR_MAX
83 #  endif
84
85 /* Minimum and maximum values a `signed short int' can hold.  */
86 #  define SHRT_MIN      (-32768)
87 #  define SHRT_MAX      32767
88
89 /* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
90 #  define USHRT_MAX     65535
91
92 /* Minimum and maximum values a `signed int' can hold.  */
93 #  define INT_MIN       (- INT_MAX - 1)
94 #  define INT_MAX       2147483647
95
96 /* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
97 #  ifdef __STDC__
98 #   define UINT_MAX     4294967295U
99 #  else
100 #   define UINT_MAX     4294967295
101 #  endif
102
103 /* Minimum and maximum values a `signed long int' can hold.  */
104 #  ifdef __alpha__
105 #   define LONG_MAX     9223372036854775807L
106 #  else
107 #   define LONG_MAX     2147483647L
108 #  endif
109 #  define LONG_MIN      (- LONG_MAX - 1L)
110
111 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
112 #  ifdef __alpha__
113 #   define ULONG_MAX    18446744073709551615UL
114 #  else
115 #   ifdef __STDC__
116 #    define ULONG_MAX   4294967295UL
117 #   else
118 #    define ULONG_MAX   4294967295L
119 #   endif
120 #  endif
121
122 # endif /* limits.h  */
123 #endif  /* GCC 2.  */