xref: /csrg-svn/sys/hp300/include/limits.h (revision 69075)
136797Sbostic /*
263160Sbostic  * Copyright (c) 1988, 1993
363160Sbostic  *	The Regents of the University of California.  All rights reserved.
436797Sbostic  *
544541Sbostic  * %sccs.include.redist.c%
636797Sbostic  *
7*69075Sbostic  *	@(#)limits.h	8.4 (Berkeley) 04/28/95
836797Sbostic  */
936797Sbostic 
1036797Sbostic #define	CHAR_BIT	8		/* number of bits in a char */
1160450Sbostic #define	MB_LEN_MAX	6		/* Allow 31 bit UTF2 */
1236797Sbostic 
1360450Sbostic 
1452899Sbostic #define	CLK_TCK		60		/* ticks per second */
1552899Sbostic 
1652899Sbostic /*
1752899Sbostic  * According to ANSI (section 2.2.4.2), the values below must be usable by
1852899Sbostic  * #if preprocessing directives.  Additionally, the expression must have the
1952899Sbostic  * same type as would an expression that is an object of the corresponding
2052899Sbostic  * type converted according to the integral promotions.  The subtraction for
2152899Sbostic  * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
2252899Sbostic  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
2359788Sbostic  * These numbers work for pcc as well.  The UINT_MAX and ULONG_MAX values
2459788Sbostic  * are written as hex so that GCC will be quiet about large integer constants.
2552899Sbostic  */
2652898Sbostic #define	SCHAR_MAX	127		/* min value for a signed char */
2760184Sbostic #define	SCHAR_MIN	(-128)		/* max value for a signed char */
2836797Sbostic 
2952898Sbostic #define	UCHAR_MAX	255		/* max value for an unsigned char */
3052898Sbostic #define	CHAR_MAX	127		/* max value for a char */
3160184Sbostic #define	CHAR_MIN	(-128)		/* min value for a char */
3236797Sbostic 
3352898Sbostic #define	USHRT_MAX	65535		/* max value for an unsigned short */
3452898Sbostic #define	SHRT_MAX	32767		/* max value for a short */
3560184Sbostic #define	SHRT_MIN	(-32768)	/* min value for a short */
3636797Sbostic 
3759788Sbostic #define	UINT_MAX	0xffffffff	/* max value for an unsigned int */
3852898Sbostic #define	INT_MAX		2147483647	/* max value for an int */
3952898Sbostic #define	INT_MIN		(-2147483647-1)	/* min value for an int */
4036797Sbostic 
41*69075Sbostic #define	ULONG_MAX	0xffffffffL	/* max value for an unsigned long */
42*69075Sbostic #define	LONG_MAX	2147483647L	/* max value for a long */
43*69075Sbostic 					/* min value for a long */
44*69075Sbostic #define	LONG_MIN	(-2147483647L-1L)
4554360Sbostic 
4665409Sbostic #if !defined(_ANSI_SOURCE)
4765409Sbostic #define	SSIZE_MAX	INT_MAX		/* max value for a ssize_t */
4865409Sbostic 
4965409Sbostic #if !defined(_POSIX_SOURCE)
5065407Sbostic #define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t */
5154417Sbostic 
5265407Sbostic /* GCC requires that quad constants be written as expressions. */
5354417Sbostic #define	UQUAD_MAX	((u_quad_t)0-1)	/* max value for a uquad_t */
5454417Sbostic 					/* max value for a quad_t */
5554417Sbostic #define	QUAD_MAX	((quad_t)(UQUAD_MAX >> 1))
5654417Sbostic #define	QUAD_MIN	(-QUAD_MAX-1)	/* min value for a quad_t */
5765409Sbostic 
5865409Sbostic #endif /* !_POSIX_SOURCE */
5965409Sbostic #endif /* !_ANSI_SOURCE */
60