xref: /csrg-svn/sys/pmax/include/limits.h (revision 69218)
169217Smckusick /*
269217Smckusick  * Copyright (c) 1988, 1993
369217Smckusick  *	The Regents of the University of California.  All rights reserved.
469217Smckusick  *
569217Smckusick  * %sccs.include.redist.c%
669217Smckusick  *
7*69218Smckusick  *	@(#)limits.h	8.2 (Berkeley) 05/04/95
869217Smckusick  */
969217Smckusick 
1069217Smckusick #define	CHAR_BIT	8		/* number of bits in a char */
1169217Smckusick #define	MB_LEN_MAX	6		/* Allow 31 bit UTF2 */
1269217Smckusick 
1369217Smckusick 
14*69218Smckusick #define	CLK_TCK		64		/* ticks per second */
1569217Smckusick 
1669217Smckusick /*
1769217Smckusick  * According to ANSI (section 2.2.4.2), the values below must be usable by
1869217Smckusick  * #if preprocessing directives.  Additionally, the expression must have the
1969217Smckusick  * same type as would an expression that is an object of the corresponding
2069217Smckusick  * type converted according to the integral promotions.  The subtraction for
2169217Smckusick  * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
2269217Smckusick  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
2369217Smckusick  * These numbers work for pcc as well.  The UINT_MAX and ULONG_MAX values
2469217Smckusick  * are written as hex so that GCC will be quiet about large integer constants.
2569217Smckusick  */
2669217Smckusick #define	SCHAR_MAX	127		/* min value for a signed char */
2769217Smckusick #define	SCHAR_MIN	(-128)		/* max value for a signed char */
2869217Smckusick 
2969217Smckusick #define	UCHAR_MAX	255		/* max value for an unsigned char */
3069217Smckusick #define	CHAR_MAX	127		/* max value for a char */
3169217Smckusick #define	CHAR_MIN	(-128)		/* min value for a char */
3269217Smckusick 
3369217Smckusick #define	USHRT_MAX	65535		/* max value for an unsigned short */
3469217Smckusick #define	SHRT_MAX	32767		/* max value for a short */
3569217Smckusick #define	SHRT_MIN	(-32768)	/* min value for a short */
3669217Smckusick 
3769217Smckusick #define	UINT_MAX	0xffffffff	/* max value for an unsigned int */
3869217Smckusick #define	INT_MAX		2147483647	/* max value for an int */
3969217Smckusick #define	INT_MIN		(-2147483647-1)	/* min value for an int */
4069217Smckusick 
4169217Smckusick #define	ULONG_MAX	0xffffffffL	/* max value for an unsigned long */
4269217Smckusick #define	LONG_MAX	2147483647L	/* max value for a long */
4369217Smckusick 					/* min value for a long */
4469217Smckusick #define	LONG_MIN	(-2147483647L-1L)
4569217Smckusick 
4669217Smckusick #if !defined(_ANSI_SOURCE)
4769217Smckusick #define	SSIZE_MAX	INT_MAX		/* max value for a ssize_t */
4869217Smckusick 
4969217Smckusick #if !defined(_POSIX_SOURCE)
5069217Smckusick #define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t */
5169217Smckusick 
5269217Smckusick /* GCC requires that quad constants be written as expressions. */
5369217Smckusick #define	UQUAD_MAX	((u_quad_t)0-1)	/* max value for a uquad_t */
5469217Smckusick 					/* max value for a quad_t */
5569217Smckusick #define	QUAD_MAX	((quad_t)(UQUAD_MAX >> 1))
5669217Smckusick #define	QUAD_MIN	(-QUAD_MAX-1)	/* min value for a quad_t */
5769217Smckusick 
5869217Smckusick #endif /* !_POSIX_SOURCE */
5969217Smckusick #endif /* !_ANSI_SOURCE */
60