1 /* This administrivia gets added to the beginning of limits.h 2 if the system has its own version of limits.h. */ 3 4 /* We use _GCC_LIMITS_H_ because we want this not to match 5 any macros that the system's limits.h uses for its own purposes. */ 6 #ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */ 7 #define _GCC_LIMITS_H_ 8 9 #ifndef _LIBC_LIMITS_H_ 10 /* Use "..." so that we find syslimits.h only in this same directory. */ 11 #include "syslimits.h" 12 #endif 13 #ifndef _LIMITS_H___ 14 #ifndef _MACH_MACHLIMITS_H_ 15 16 /* _MACH_MACHLIMITS_H_ is used on OSF/1. */ 17 #define _LIMITS_H___ 18 #define _MACH_MACHLIMITS_H_ 19 20 /* Number of bits in a `char'. */ 21 #undef CHAR_BIT 22 #define CHAR_BIT 8 23 24 /* Maximum length of a multibyte character. */ 25 #ifndef MB_LEN_MAX 26 #define MB_LEN_MAX 16 27 #endif 28 29 /* Minimum and maximum values a `signed char' can hold. */ 30 #undef SCHAR_MIN 31 #define SCHAR_MIN (-128) 32 #undef SCHAR_MAX 33 #define SCHAR_MAX 127 34 35 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */ 36 #undef UCHAR_MAX 37 #define UCHAR_MAX 255 38 39 /* Minimum and maximum values a `char' can hold. */ 40 #ifdef __CHAR_UNSIGNED__ 41 #undef CHAR_MIN 42 #define CHAR_MIN 0 43 #undef CHAR_MAX 44 #define CHAR_MAX 255 45 #else 46 #undef CHAR_MIN 47 #define CHAR_MIN (-128) 48 #undef CHAR_MAX 49 #define CHAR_MAX 127 50 #endif 51 52 /* Minimum and maximum values a `signed short int' can hold. */ 53 #undef SHRT_MIN 54 /* For the sake of 16 bit hosts, we may not use -32768 */ 55 #define SHRT_MIN (-32767-1) 56 #undef SHRT_MAX 57 #define SHRT_MAX 32767 58 59 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ 60 #undef USHRT_MAX 61 #define USHRT_MAX 65535 62 63 /* Minimum and maximum values a `signed int' can hold. */ 64 #ifndef __INT_MAX__ 65 #define __INT_MAX__ 2147483647 66 #endif 67 #undef INT_MIN 68 #define INT_MIN (-INT_MAX-1) 69 #undef INT_MAX 70 #define INT_MAX __INT_MAX__ 71 72 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */ 73 #undef UINT_MAX 74 #define UINT_MAX (INT_MAX * 2U + 1) 75 76 /* Minimum and maximum values a `signed long int' can hold. 77 (Same as `int'). */ 78 #ifndef __LONG_MAX__ 79 #if defined (__alpha__) || (defined (_ARCH_PPC) && defined (__64BIT__)) || defined (__sparc_v9__) || defined (__sparcv9) 80 #define __LONG_MAX__ 9223372036854775807L 81 #else 82 #define __LONG_MAX__ 2147483647L 83 #endif /* __alpha__ || sparc64 */ 84 #endif 85 #undef LONG_MIN 86 #define LONG_MIN (-LONG_MAX-1) 87 #undef LONG_MAX 88 #define LONG_MAX __LONG_MAX__ 89 90 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ 91 #undef ULONG_MAX 92 #define ULONG_MAX (LONG_MAX * 2UL + 1) 93 94 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) 95 /* Minimum and maximum values a `signed long long int' can hold. */ 96 #ifndef __LONG_LONG_MAX__ 97 #define __LONG_LONG_MAX__ 9223372036854775807LL 98 #endif 99 #undef LONG_LONG_MIN 100 #define LONG_LONG_MIN (-LONG_LONG_MAX-1) 101 #undef LONG_LONG_MAX 102 #define LONG_LONG_MAX __LONG_LONG_MAX__ 103 104 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ 105 #undef ULONG_LONG_MAX 106 #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) 107 #endif 108 109 #endif /* _MACH_MACHLIMITS_H_ */ 110 #endif /* _LIMITS_H___ */ 111 /* This administrivia gets added to the end of limits.h 112 if the system has its own version of limits.h. */ 113 114 #else /* not _GCC_LIMITS_H_ */ 115 116 #ifdef _GCC_NEXT_LIMITS_H 117 #include_next <limits.h> /* recurse down to the real one */ 118 #endif 119 120 #endif /* not _GCC_LIMITS_H_ */ 121