xref: /csrg-svn/sys/pmax/include/limits.h (revision 69217)
1*69217Smckusick /*
2*69217Smckusick  * Copyright (c) 1988, 1993
3*69217Smckusick  *	The Regents of the University of California.  All rights reserved.
4*69217Smckusick  *
5*69217Smckusick  * %sccs.include.redist.c%
6*69217Smckusick  *
7*69217Smckusick  *	@(#)limits.h	8.1 (Berkeley) 05/04/95
8*69217Smckusick  */
9*69217Smckusick 
10*69217Smckusick #define	CHAR_BIT	8		/* number of bits in a char */
11*69217Smckusick #define	MB_LEN_MAX	6		/* Allow 31 bit UTF2 */
12*69217Smckusick 
13*69217Smckusick 
14*69217Smckusick #define	CLK_TCK		60		/* ticks per second */
15*69217Smckusick 
16*69217Smckusick /*
17*69217Smckusick  * According to ANSI (section 2.2.4.2), the values below must be usable by
18*69217Smckusick  * #if preprocessing directives.  Additionally, the expression must have the
19*69217Smckusick  * same type as would an expression that is an object of the corresponding
20*69217Smckusick  * type converted according to the integral promotions.  The subtraction for
21*69217Smckusick  * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
22*69217Smckusick  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
23*69217Smckusick  * These numbers work for pcc as well.  The UINT_MAX and ULONG_MAX values
24*69217Smckusick  * are written as hex so that GCC will be quiet about large integer constants.
25*69217Smckusick  */
26*69217Smckusick #define	SCHAR_MAX	127		/* min value for a signed char */
27*69217Smckusick #define	SCHAR_MIN	(-128)		/* max value for a signed char */
28*69217Smckusick 
29*69217Smckusick #define	UCHAR_MAX	255		/* max value for an unsigned char */
30*69217Smckusick #define	CHAR_MAX	127		/* max value for a char */
31*69217Smckusick #define	CHAR_MIN	(-128)		/* min value for a char */
32*69217Smckusick 
33*69217Smckusick #define	USHRT_MAX	65535		/* max value for an unsigned short */
34*69217Smckusick #define	SHRT_MAX	32767		/* max value for a short */
35*69217Smckusick #define	SHRT_MIN	(-32768)	/* min value for a short */
36*69217Smckusick 
37*69217Smckusick #define	UINT_MAX	0xffffffff	/* max value for an unsigned int */
38*69217Smckusick #define	INT_MAX		2147483647	/* max value for an int */
39*69217Smckusick #define	INT_MIN		(-2147483647-1)	/* min value for an int */
40*69217Smckusick 
41*69217Smckusick #define	ULONG_MAX	0xffffffffL	/* max value for an unsigned long */
42*69217Smckusick #define	LONG_MAX	2147483647L	/* max value for a long */
43*69217Smckusick 					/* min value for a long */
44*69217Smckusick #define	LONG_MIN	(-2147483647L-1L)
45*69217Smckusick 
46*69217Smckusick #if !defined(_ANSI_SOURCE)
47*69217Smckusick #define	SSIZE_MAX	INT_MAX		/* max value for a ssize_t */
48*69217Smckusick 
49*69217Smckusick #if !defined(_POSIX_SOURCE)
50*69217Smckusick #define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t */
51*69217Smckusick 
52*69217Smckusick /* GCC requires that quad constants be written as expressions. */
53*69217Smckusick #define	UQUAD_MAX	((u_quad_t)0-1)	/* max value for a uquad_t */
54*69217Smckusick 					/* max value for a quad_t */
55*69217Smckusick #define	QUAD_MAX	((quad_t)(UQUAD_MAX >> 1))
56*69217Smckusick #define	QUAD_MIN	(-QUAD_MAX-1)	/* min value for a quad_t */
57*69217Smckusick 
58*69217Smckusick #endif /* !_POSIX_SOURCE */
59*69217Smckusick #endif /* !_ANSI_SOURCE */
60