]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/i386/limits.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / i386 / limits.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * Copyright (c) 1988, 1993
32 * The Regents of the University of California. All rights reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
61 *
62 * @(#)limits.h 8.3 (Berkeley) 1/4/94
63 */
64/*
65 * HISTORY
66 *
67 * 10-July-97 Umesh Vaishampayan (umeshv@apple.com)
68 * Avoid multiple includes.
69 */
70
71#ifndef _I386_LIMITS_H_
72#define _I386_LIMITS_H_
73
91447636
A
74#include <i386/_limits.h>
75
1c79356b
A
76#define CHAR_BIT 8 /* number of bits in a char */
77#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
78
91447636
A
79#ifndef CLK_TCK
80#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
81#endif
1c79356b
A
82
83/*
84 * According to ANSI (section 2.2.4.2), the values below must be usable by
85 * #if preprocessing directives. Additionally, the expression must have the
86 * same type as would an expression that is an object of the corresponding
87 * type converted according to the integral promotions. The subtraction for
88 * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
89 * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
90 * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
91 * are written as hex so that GCC will be quiet about large integer constants.
92 */
93#define SCHAR_MAX 127 /* min value for a signed char */
94#define SCHAR_MIN (-128) /* max value for a signed char */
95
96#define UCHAR_MAX 255 /* max value for an unsigned char */
97#define CHAR_MAX 127 /* max value for a char */
98#define CHAR_MIN (-128) /* min value for a char */
99
100#define USHRT_MAX 65535 /* max value for an unsigned short */
101#define SHRT_MAX 32767 /* max value for a short */
102#define SHRT_MIN (-32768) /* min value for a short */
103
104#define UINT_MAX 0xffffffff /* max value for an unsigned int */
105#define INT_MAX 2147483647 /* max value for an int */
106#define INT_MIN (-2147483647-1) /* min value for an int */
107
108#define ULONG_MAX 0xffffffff /* max value for an unsigned long */
109#define LONG_MAX 2147483647 /* max value for a long */
110#define LONG_MIN (-2147483647-1) /* min value for a long */
111
112#if !defined(_ANSI_SOURCE)
113#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
114
115#if !defined(_POSIX_SOURCE)
116#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
117
118/* GCC requires that quad constants be written as expressions. */
119#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */
120 /* max value for a quad_t */
121#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1))
122#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */
123
124#endif /* !_POSIX_SOURCE */
125#endif /* !_ANSI_SOURCE */
126
127#endif /* _I386_LIMITS_H_ */