1a70e39f5Sbostic /* 2a2ef35f5Sbostic * Copyright (c) 1988, 1993 3a2ef35f5Sbostic * The Regents of the University of California. All rights reserved. 4a70e39f5Sbostic * 505bc5180Sbostic * %sccs.include.redist.c% 6a70e39f5Sbostic * 7*3be66735Sbostic * @(#)limits.h 8.4 (Berkeley) 04/28/95 8a70e39f5Sbostic */ 9a70e39f5Sbostic 10a70e39f5Sbostic #define CHAR_BIT 8 /* number of bits in a char */ 115c14899cSbostic #define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ 125c14899cSbostic 13a70e39f5Sbostic 14cc40e0b1Sbostic #define CLK_TCK 60 /* ticks per second */ 15cc40e0b1Sbostic 16cc40e0b1Sbostic /* 17cc40e0b1Sbostic * According to ANSI (section 2.2.4.2), the values below must be usable by 18cc40e0b1Sbostic * #if preprocessing directives. Additionally, the expression must have the 19cc40e0b1Sbostic * same type as would an expression that is an object of the corresponding 20cc40e0b1Sbostic * type converted according to the integral promotions. The subtraction for 21cc40e0b1Sbostic * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an 22cc40e0b1Sbostic * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 2304f8baaeSbostic * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values 2404f8baaeSbostic * are written as hex so that GCC will be quiet about large integer constants. 25cc40e0b1Sbostic */ 26f38cc44cSbostic #define SCHAR_MAX 127 /* min value for a signed char */ 272a164961Sbostic #define SCHAR_MIN (-128) /* max value for a signed char */ 28a70e39f5Sbostic 29f38cc44cSbostic #define UCHAR_MAX 255 /* max value for an unsigned char */ 30f38cc44cSbostic #define CHAR_MAX 127 /* max value for a char */ 312a164961Sbostic #define CHAR_MIN (-128) /* min value for a char */ 32a70e39f5Sbostic 33f38cc44cSbostic #define USHRT_MAX 65535 /* max value for an unsigned short */ 34f38cc44cSbostic #define SHRT_MAX 32767 /* max value for a short */ 352a164961Sbostic #define SHRT_MIN (-32768) /* min value for a short */ 36a70e39f5Sbostic 3704f8baaeSbostic #define UINT_MAX 0xffffffff /* max value for an unsigned int */ 38f38cc44cSbostic #define INT_MAX 2147483647 /* max value for an int */ 39f38cc44cSbostic #define INT_MIN (-2147483647-1) /* min value for an int */ 40a70e39f5Sbostic 41*3be66735Sbostic #define ULONG_MAX 0xffffffffL /* max value for an unsigned long */ 42*3be66735Sbostic #define LONG_MAX 2147483647L /* max value for a long */ 43*3be66735Sbostic /* min value for a long */ 44*3be66735Sbostic #define LONG_MIN (-2147483647L-1L) 45f2c974bcSbostic 4614d6ac35Sbostic #if !defined(_ANSI_SOURCE) 4714d6ac35Sbostic #define SSIZE_MAX INT_MAX /* max value for a ssize_t */ 4814d6ac35Sbostic 4914d6ac35Sbostic #if !defined(_POSIX_SOURCE) 5036f00105Sbostic #define SIZE_T_MAX UINT_MAX /* max value for a size_t */ 516530a277Sbostic 5236f00105Sbostic /* GCC requires that quad constants be written as expressions. */ 536530a277Sbostic #define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ 546530a277Sbostic /* max value for a quad_t */ 556530a277Sbostic #define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) 566530a277Sbostic #define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ 5714d6ac35Sbostic 5814d6ac35Sbostic #endif /* !_POSIX_SOURCE */ 5914d6ac35Sbostic #endif /* !_ANSI_SOURCE */ 60