139193Sjdp/* This administrivia gets added to the beginning of limits.h 2130809Smarcel if the system has its own version of limits.h. */ 3130809Smarcel 498948Sobrien/* We use _GCC_LIMITS_H_ because we want this not to match 539193Sjdp any macros that the system's limits.h uses for its own purposes. */ 698948Sobrien#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */ 739193Sjdp#define _GCC_LIMITS_H_ 898948Sobrien 998948Sobrien#ifndef _LIBC_LIMITS_H_ 1098948Sobrien/* Use "..." so that we find syslimits.h only in this same directory. */ 1198948Sobrien#include "syslimits.h" 1239193Sjdp#endif 1398948Sobrien#ifndef _LIMITS_H___ 1498948Sobrien#ifndef _MACH_MACHLIMITS_H_ 1598948Sobrien 1698948Sobrien/* _MACH_MACHLIMITS_H_ is used on OSF/1. */ 1739193Sjdp#define _LIMITS_H___ 1898948Sobrien#define _MACH_MACHLIMITS_H_ 1998948Sobrien 2098948Sobrien/* Number of bits in a `char'. */ 2198948Sobrien#undef CHAR_BIT 2239193Sjdp#define CHAR_BIT 8 23130809Smarcel 24130809Smarcel/* Maximum length of a multibyte character. */ 25130809Smarcel#ifndef MB_LEN_MAX 26130809Smarcel#define MB_LEN_MAX 16 27130809Smarcel#endif 28130809Smarcel 29130809Smarcel/* Minimum and maximum values a `signed char' can hold. */ 30130809Smarcel#undef SCHAR_MIN 3139193Sjdp#define SCHAR_MIN (-128) 3239193Sjdp#undef SCHAR_MAX 33130809Smarcel#define SCHAR_MAX 127 34130809Smarcel 35130809Smarcel/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ 36130809Smarcel#undef UCHAR_MAX 3739193Sjdp#define UCHAR_MAX 255 38130809Smarcel 39130809Smarcel/* Minimum and maximum values a `char' can hold. */ 40130809Smarcel#ifdef __CHAR_UNSIGNED__ 4139193Sjdp#undef CHAR_MIN 4239193Sjdp#define CHAR_MIN 0 4339193Sjdp#undef CHAR_MAX 4439193Sjdp#define CHAR_MAX 255 4539193Sjdp#else 46130809Smarcel#undef CHAR_MIN 4798948Sobrien#define CHAR_MIN (-128) 4846289Sdfr#undef CHAR_MAX 49130809Smarcel#define CHAR_MAX 127 5046289Sdfr#endif 51130809Smarcel 52130809Smarcel/* Minimum and maximum values a `signed short int' can hold. */ 53130809Smarcel#undef SHRT_MIN 5498948Sobrien/* For the sake of 16 bit hosts, we may not use -32768 */ 55130809Smarcel#define SHRT_MIN (-32767-1) 56130809Smarcel#undef SHRT_MAX 57130809Smarcel#define SHRT_MAX 32767 5839193Sjdp 59130809Smarcel/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ 6039193Sjdp#undef USHRT_MAX 6139193Sjdp#define USHRT_MAX 65535 6298948Sobrien 6398948Sobrien/* Minimum and maximum values a `signed int' can hold. */ 6439193Sjdp#ifndef __INT_MAX__ 6598948Sobrien#define __INT_MAX__ 2147483647 6698948Sobrien#endif 6739193Sjdp#undef INT_MIN 68130809Smarcel#define INT_MIN (-INT_MAX-1) 6939193Sjdp#undef INT_MAX 70130809Smarcel#define INT_MAX __INT_MAX__ 7139193Sjdp 72130809Smarcel/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ 7339193Sjdp#undef UINT_MAX 7439193Sjdp#define UINT_MAX (INT_MAX * 2U + 1) 75130809Smarcel 7639193Sjdp/* Minimum and maximum values a `signed long int' can hold. 7739193Sjdp (Same as `int'). */ 78130809Smarcel#ifndef __LONG_MAX__ 79130809Smarcel#if defined (__alpha__) || (defined (_ARCH_PPC) && defined (__64BIT__)) || defined (__sparc_v9__) || defined (__sparcv9) 80130809Smarcel#define __LONG_MAX__ 9223372036854775807L 8139193Sjdp#else 82130809Smarcel#define __LONG_MAX__ 2147483647L 8339193Sjdp#endif /* __alpha__ || sparc64 */ 8439193Sjdp#endif 85130809Smarcel#undef LONG_MIN 8698948Sobrien#define LONG_MIN (-LONG_MAX-1) 8798948Sobrien#undef LONG_MAX 8839193Sjdp#define LONG_MAX __LONG_MAX__ 89130809Smarcel 90130809Smarcel/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ 91130809Smarcel#undef ULONG_MAX 92130809Smarcel#define ULONG_MAX (LONG_MAX * 2UL + 1) 93130809Smarcel 94130809Smarcel#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) 95130809Smarcel/* Minimum and maximum values a `signed long long int' can hold. */ 9639193Sjdp#ifndef __LONG_LONG_MAX__ 9739193Sjdp#define __LONG_LONG_MAX__ 9223372036854775807LL 9898948Sobrien#endif 9939193Sjdp#undef LONG_LONG_MIN 100130809Smarcel#define LONG_LONG_MIN (-LONG_LONG_MAX-1) 101130809Smarcel#undef LONG_LONG_MAX 10239193Sjdp#define LONG_LONG_MAX __LONG_LONG_MAX__ 10339193Sjdp 10439193Sjdp/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 10598948Sobrien#undef ULONG_LONG_MAX 10698948Sobrien#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) 10798948Sobrien#endif 10898948Sobrien 10998948Sobrien#endif /* _MACH_MACHLIMITS_H_ */ 11039193Sjdp#endif /* _LIMITS_H___ */ 11139193Sjdp/* This administrivia gets added to the end of limits.h 112130809Smarcel if the system has its own version of limits.h. */ 113130809Smarcel 114130809Smarcel#else /* not _GCC_LIMITS_H_ */ 11539193Sjdp 11698948Sobrien#ifdef _GCC_NEXT_LIMITS_H 11739193Sjdp#include_next <limits.h> /* recurse down to the real one */ 11839193Sjdp#endif 11939193Sjdp 120#endif /* not _GCC_LIMITS_H_ */ 121