_limits.h revision 122940
199127Sobrien/*
299127Sobrien * Copyright (c) 1988, 1993
399127Sobrien *	The Regents of the University of California.  All rights reserved.
499127Sobrien *
599127Sobrien * Redistribution and use in source and binary forms, with or without
699127Sobrien * modification, are permitted provided that the following conditions
799127Sobrien * are met:
899127Sobrien * 1. Redistributions of source code must retain the above copyright
999127Sobrien *    notice, this list of conditions and the following disclaimer.
1099127Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1199127Sobrien *    notice, this list of conditions and the following disclaimer in the
1299127Sobrien *    documentation and/or other materials provided with the distribution.
1399127Sobrien * 3. All advertising materials mentioning features or use of this software
1499127Sobrien *    must display the following acknowledgement:
1599127Sobrien *	This product includes software developed by the University of
1699127Sobrien *	California, Berkeley and its contributors.
1799127Sobrien * 4. Neither the name of the University nor the names of its contributors
1899127Sobrien *    may be used to endorse or promote products derived from this software
1999127Sobrien *    without specific prior written permission.
20114370Speter *
21114370Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22114370Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23114370Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24114370Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25114370Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26114370Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27114370Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28114370Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29114370Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30114370Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31114370Speter * SUCH DAMAGE.
32114370Speter *
3399127Sobrien *	@(#)limits.h	8.3 (Berkeley) 1/4/94
34113536Sphk * $FreeBSD: head/sys/amd64/include/_limits.h 122940 2003-11-21 03:02:00Z peter $
3599127Sobrien */
3699127Sobrien
3799127Sobrien#ifndef	_MACHINE__LIMITS_H_
3899127Sobrien#define	_MACHINE__LIMITS_H_
3999127Sobrien
4099127Sobrien/*
4199127Sobrien * According to ANSI (section 2.2.4.2), the values below must be usable by
4299127Sobrien * #if preprocessing directives.  Additionally, the expression must have the
4399127Sobrien * same type as would an expression that is an object of the corresponding
4499127Sobrien * type converted according to the integral promotions.  The subtraction for
4599127Sobrien * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
4699127Sobrien * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
47114370Speter * These numbers are for the default configuration of gcc.  They work for
4899127Sobrien * some other compilers as well, but this should not be depended on.
4999127Sobrien */
5099127Sobrien
5199127Sobrien#define	__CHAR_BIT	8		/* number of bits in a char */
5299127Sobrien
5399127Sobrien#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
5499127Sobrien#define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
5599127Sobrien
5699127Sobrien#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
5799127Sobrien
5899127Sobrien#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
5999127Sobrien#define	__SHRT_MAX	0x7fff		/* max value for a short */
6099127Sobrien#define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
6199127Sobrien
6299127Sobrien#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
6399127Sobrien#define	__INT_MAX	0x7fffffff	/* max value for an int */
64#define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
65
66#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
67#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
68#define	__LONG_MIN	(-0x7fffffffffffffffL - 1) /* min for a long */
69
70			/* max value for an unsigned long long */
71#define	__ULLONG_MAX	0xffffffffffffffffULL
72#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
73#define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
74
75#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
76
77#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
78
79#define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
80#define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
81
82/* Quads and longs are the same on the amd64.  Ensure they stay in sync. */
83#define	__UQUAD_MAX	__ULONG_MAX	/* max value for a uquad_t */
84#define	__QUAD_MAX	__LONG_MAX	/* max value for a quad_t */
85#define	__QUAD_MIN	__LONG_MIN	/* min value for a quad_t */
86
87#define	__LONG_BIT	64
88#define	__WORD_BIT	32
89
90#endif /* !_MACHINE__LIMITS_H_ */
91