1*e4b17023SJohn Marino /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2*e4b17023SJohn Marino 2002 Free Software Foundation, Inc. 3*e4b17023SJohn Marino 4*e4b17023SJohn Marino This file is part of GCC. 5*e4b17023SJohn Marino 6*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under 7*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free 8*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later 9*e4b17023SJohn Marino version. 10*e4b17023SJohn Marino 11*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY 12*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or 13*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14*e4b17023SJohn Marino for more details. 15*e4b17023SJohn Marino 16*e4b17023SJohn Marino Under Section 7 of GPL version 3, you are granted additional 17*e4b17023SJohn Marino permissions described in the GCC Runtime Library Exception, version 18*e4b17023SJohn Marino 3.1, as published by the Free Software Foundation. 19*e4b17023SJohn Marino 20*e4b17023SJohn Marino You should have received a copy of the GNU General Public License and 21*e4b17023SJohn Marino a copy of the GCC Runtime Library Exception along with this program; 22*e4b17023SJohn Marino see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */ 24*e4b17023SJohn Marino 25*e4b17023SJohn Marino #ifndef _LIMITS_H___ 26*e4b17023SJohn Marino #define _LIMITS_H___ 27*e4b17023SJohn Marino 28*e4b17023SJohn Marino /* Number of bits in a `char'. */ 29*e4b17023SJohn Marino #undef CHAR_BIT 30*e4b17023SJohn Marino #define CHAR_BIT __CHAR_BIT__ 31*e4b17023SJohn Marino 32*e4b17023SJohn Marino /* Maximum length of a multibyte character. */ 33*e4b17023SJohn Marino #ifndef MB_LEN_MAX 34*e4b17023SJohn Marino #define MB_LEN_MAX 1 35*e4b17023SJohn Marino #endif 36*e4b17023SJohn Marino 37*e4b17023SJohn Marino /* Minimum and maximum values a `signed char' can hold. */ 38*e4b17023SJohn Marino #undef SCHAR_MIN 39*e4b17023SJohn Marino #define SCHAR_MIN (-SCHAR_MAX - 1) 40*e4b17023SJohn Marino #undef SCHAR_MAX 41*e4b17023SJohn Marino #define SCHAR_MAX __SCHAR_MAX__ 42*e4b17023SJohn Marino 43*e4b17023SJohn Marino /* Maximum value an `unsigned char' can hold. (Minimum is 0). */ 44*e4b17023SJohn Marino #undef UCHAR_MAX 45*e4b17023SJohn Marino #if __SCHAR_MAX__ == __INT_MAX__ 46*e4b17023SJohn Marino # define UCHAR_MAX (SCHAR_MAX * 2U + 1U) 47*e4b17023SJohn Marino #else 48*e4b17023SJohn Marino # define UCHAR_MAX (SCHAR_MAX * 2 + 1) 49*e4b17023SJohn Marino #endif 50*e4b17023SJohn Marino 51*e4b17023SJohn Marino /* Minimum and maximum values a `char' can hold. */ 52*e4b17023SJohn Marino #ifdef __CHAR_UNSIGNED__ 53*e4b17023SJohn Marino # undef CHAR_MIN 54*e4b17023SJohn Marino # if __SCHAR_MAX__ == __INT_MAX__ 55*e4b17023SJohn Marino # define CHAR_MIN 0U 56*e4b17023SJohn Marino # else 57*e4b17023SJohn Marino # define CHAR_MIN 0 58*e4b17023SJohn Marino # endif 59*e4b17023SJohn Marino # undef CHAR_MAX 60*e4b17023SJohn Marino # define CHAR_MAX UCHAR_MAX 61*e4b17023SJohn Marino #else 62*e4b17023SJohn Marino # undef CHAR_MIN 63*e4b17023SJohn Marino # define CHAR_MIN SCHAR_MIN 64*e4b17023SJohn Marino # undef CHAR_MAX 65*e4b17023SJohn Marino # define CHAR_MAX SCHAR_MAX 66*e4b17023SJohn Marino #endif 67*e4b17023SJohn Marino 68*e4b17023SJohn Marino /* Minimum and maximum values a `signed short int' can hold. */ 69*e4b17023SJohn Marino #undef SHRT_MIN 70*e4b17023SJohn Marino #define SHRT_MIN (-SHRT_MAX - 1) 71*e4b17023SJohn Marino #undef SHRT_MAX 72*e4b17023SJohn Marino #define SHRT_MAX __SHRT_MAX__ 73*e4b17023SJohn Marino 74*e4b17023SJohn Marino /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ 75*e4b17023SJohn Marino #undef USHRT_MAX 76*e4b17023SJohn Marino #if __SHRT_MAX__ == __INT_MAX__ 77*e4b17023SJohn Marino # define USHRT_MAX (SHRT_MAX * 2U + 1U) 78*e4b17023SJohn Marino #else 79*e4b17023SJohn Marino # define USHRT_MAX (SHRT_MAX * 2 + 1) 80*e4b17023SJohn Marino #endif 81*e4b17023SJohn Marino 82*e4b17023SJohn Marino /* Minimum and maximum values a `signed int' can hold. */ 83*e4b17023SJohn Marino #undef INT_MIN 84*e4b17023SJohn Marino #define INT_MIN (-INT_MAX - 1) 85*e4b17023SJohn Marino #undef INT_MAX 86*e4b17023SJohn Marino #define INT_MAX __INT_MAX__ 87*e4b17023SJohn Marino 88*e4b17023SJohn Marino /* Maximum value an `unsigned int' can hold. (Minimum is 0). */ 89*e4b17023SJohn Marino #undef UINT_MAX 90*e4b17023SJohn Marino #define UINT_MAX (INT_MAX * 2U + 1U) 91*e4b17023SJohn Marino 92*e4b17023SJohn Marino /* Minimum and maximum values a `signed long int' can hold. 93*e4b17023SJohn Marino (Same as `int'). */ 94*e4b17023SJohn Marino #undef LONG_MIN 95*e4b17023SJohn Marino #define LONG_MIN (-LONG_MAX - 1L) 96*e4b17023SJohn Marino #undef LONG_MAX 97*e4b17023SJohn Marino #define LONG_MAX __LONG_MAX__ 98*e4b17023SJohn Marino 99*e4b17023SJohn Marino /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ 100*e4b17023SJohn Marino #undef ULONG_MAX 101*e4b17023SJohn Marino #define ULONG_MAX (LONG_MAX * 2UL + 1UL) 102*e4b17023SJohn Marino 103*e4b17023SJohn Marino #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 104*e4b17023SJohn Marino /* Minimum and maximum values a `signed long long int' can hold. */ 105*e4b17023SJohn Marino # undef LLONG_MIN 106*e4b17023SJohn Marino # define LLONG_MIN (-LLONG_MAX - 1LL) 107*e4b17023SJohn Marino # undef LLONG_MAX 108*e4b17023SJohn Marino # define LLONG_MAX __LONG_LONG_MAX__ 109*e4b17023SJohn Marino 110*e4b17023SJohn Marino /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 111*e4b17023SJohn Marino # undef ULLONG_MAX 112*e4b17023SJohn Marino # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) 113*e4b17023SJohn Marino #endif 114*e4b17023SJohn Marino 115*e4b17023SJohn Marino #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) 116*e4b17023SJohn Marino /* Minimum and maximum values a `signed long long int' can hold. */ 117*e4b17023SJohn Marino # undef LONG_LONG_MIN 118*e4b17023SJohn Marino # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL) 119*e4b17023SJohn Marino # undef LONG_LONG_MAX 120*e4b17023SJohn Marino # define LONG_LONG_MAX __LONG_LONG_MAX__ 121*e4b17023SJohn Marino 122*e4b17023SJohn Marino /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 123*e4b17023SJohn Marino # undef ULONG_LONG_MAX 124*e4b17023SJohn Marino # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL) 125*e4b17023SJohn Marino #endif 126*e4b17023SJohn Marino 127*e4b17023SJohn Marino #endif /* _LIMITS_H___ */ 128