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