_limits.h revision 139790
1249508Sivoras/* $FreeBSD: head/sys/ia64/include/_limits.h 139790 2005-01-06 22:18:23Z imp $ */
2249508Sivoras/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp */
3249508Sivoras
4249508Sivoras/*-
5249508Sivoras * Copyright (c) 1988, 1993
6249508Sivoras *	The Regents of the University of California.  All rights reserved.
7249508Sivoras *
8249508Sivoras * Redistribution and use in source and binary forms, with or without
9249508Sivoras * modification, are permitted provided that the following conditions
10249508Sivoras * are met:
11249508Sivoras * 1. Redistributions of source code must retain the above copyright
12249508Sivoras *    notice, this list of conditions and the following disclaimer.
13249508Sivoras * 2. Redistributions in binary form must reproduce the above copyright
14249508Sivoras *    notice, this list of conditions and the following disclaimer in the
15249508Sivoras *    documentation and/or other materials provided with the distribution.
16249508Sivoras * 4. Neither the name of the University nor the names of its contributors
17249508Sivoras *    may be used to endorse or promote products derived from this software
18249508Sivoras *    without specific prior written permission.
19249508Sivoras *
20249508Sivoras * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21249508Sivoras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22249508Sivoras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23249508Sivoras * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24249508Sivoras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25249508Sivoras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26249508Sivoras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27249508Sivoras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28249508Sivoras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29249508Sivoras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30249508Sivoras * SUCH DAMAGE.
31249508Sivoras *
32249508Sivoras *	@(#)limits.h	8.3 (Berkeley) 1/4/94
33249508Sivoras */
34249508Sivoras
35249508Sivoras#ifndef _MACHINE__LIMITS_H_
36249508Sivoras#define	_MACHINE__LIMITS_H_
37249508Sivoras
38249508Sivoras/*
39249508Sivoras * According to ANSI (section 2.2.4.2), the values below must be usable by
40249508Sivoras * #if preprocessing directives.  Additionally, the expression must have the
41249508Sivoras * same type as would an expression that is an object of the corresponding
42249508Sivoras * type converted according to the integral promotions.  The subtraction for
43249564Sivoras * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
44249564Sivoras * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
45249508Sivoras * These numbers are for the default configuration of gcc.  They work for
46249508Sivoras * some other compilers as well, but this should not be depended on.
47249508Sivoras */
48249508Sivoras
49249508Sivoras#define	__CHAR_BIT	8		/* number of bits in a char */
50249508Sivoras
51249564Sivoras#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
52249508Sivoras#define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
53249508Sivoras
54249508Sivoras#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
55249508Sivoras
56249508Sivoras#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
57249508Sivoras#define	__SHRT_MAX	0x7fff		/* max value for a short */
58249564Sivoras#define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
59249564Sivoras
60249564Sivoras#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
61249564Sivoras#define	__INT_MAX	0x7fffffff	/* max value for an int */
62249564Sivoras#define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
63249508Sivoras
64249508Sivoras#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
65249508Sivoras#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
66249564Sivoras#define	__LONG_MIN	(-0x7fffffffffffffffL-1) /* min for a long */
67249564Sivoras
68249508Sivoras/* Long longs and longs are the same size on the IA-64. */
69249564Sivoras					/* max for an unsigned long long */
70249564Sivoras#define	__ULLONG_MAX	0xffffffffffffffffULL
71249508Sivoras#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */
72249508Sivoras#define	__LLONG_MIN	(-0x7fffffffffffffffLL-1) /* min for a long long */
73249564Sivoras
74249564Sivoras#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
75249564Sivoras
76249564Sivoras#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
77249564Sivoras
78249508Sivoras#define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
79249508Sivoras#define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
80249508Sivoras
81249508Sivoras/* Quads and longs are the same.  Ensure they stay in sync. */
82249508Sivoras#define	__UQUAD_MAX	(__ULONG_MAX)	/* max value for a uquad_t */
83249508Sivoras#define	__QUAD_MAX	(__LONG_MAX)	/* max value for a quad_t */
84249508Sivoras#define	__QUAD_MIN	(__LONG_MIN)	/* min value for a quad_t */
85249508Sivoras
86249508Sivoras#define	__LONG_BIT	64
87249564Sivoras#define	__WORD_BIT	32
88249564Sivoras
89#endif /* !_MACHINE__LIMITS_H_ */
90