]> git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/machine/limits.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / machine / limits.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 #if !defined (_LIMITS_H___) && !defined (_MACH_MACHLIMITS_H_)
29 #if defined (__ppc__)
30 #include <ppc/limits.h>
31 #elif defined (__i386__)
32 #include <i386/limits.h>
33 #else
34 #error architecture not supported
35 #endif
36 #undef MB_LEN_MAX
37 #endif
38 #ifndef _LIMITS_H___
39 #ifndef _MACH_MACHLIMITS_H_
40
41 /* _MACH_MACHLIMITS_H_ is used on OSF/1. */
42 #define _LIMITS_H___
43 #define _MACH_MACHLIMITS_H_
44
45 /* Number of bits in a `char'. */
46 #undef CHAR_BIT
47 #define CHAR_BIT 8
48
49 /* Maximum length of a multibyte character. */
50 #ifndef MB_LEN_MAX
51 #define MB_LEN_MAX 1
52 #endif
53
54 /* Minimum and maximum values a `signed char' can hold. */
55 #undef SCHAR_MIN
56 #define SCHAR_MIN (-128)
57 #undef SCHAR_MAX
58 #define SCHAR_MAX 127
59
60 /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
61 #undef UCHAR_MAX
62 #define UCHAR_MAX 255
63
64 /* Minimum and maximum values a `char' can hold. */
65 #ifdef __CHAR_UNSIGNED__
66 #undef CHAR_MIN
67 #define CHAR_MIN 0
68 #undef CHAR_MAX
69 #define CHAR_MAX 255
70 #else
71 #undef CHAR_MIN
72 #define CHAR_MIN (-128)
73 #undef CHAR_MAX
74 #define CHAR_MAX 127
75 #endif
76
77 /* Minimum and maximum values a `signed short int' can hold. */
78 #undef SHRT_MIN
79 #define SHRT_MIN (-32768)
80 #undef SHRT_MAX
81 #define SHRT_MAX 32767
82
83 /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
84 #undef USHRT_MAX
85 #define USHRT_MAX 65535
86
87 /* Minimum and maximum values a `signed int' can hold. */
88 #ifndef __INT_MAX__
89 #define __INT_MAX__ 2147483647
90 #endif
91 #undef INT_MIN
92 #define INT_MIN (-INT_MAX-1)
93 #undef INT_MAX
94 #define INT_MAX __INT_MAX__
95
96 /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
97 #undef UINT_MAX
98 #define UINT_MAX (INT_MAX * 2U + 1)
99
100 /* Minimum and maximum values a `signed long int' can hold.
101 (Same as `int'). */
102 #ifndef __LONG_MAX__
103 #define __LONG_MAX__ 2147483647L
104 #endif
105 #undef LONG_MIN
106 #define LONG_MIN (-LONG_MAX-1)
107 #undef LONG_MAX
108 #define LONG_MAX __LONG_MAX__
109
110 /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
111 #undef ULONG_MAX
112 #define ULONG_MAX (LONG_MAX * 2UL + 1)
113
114 #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
115 /* Minimum and maximum values a `signed long long int' can hold. */
116 #ifndef __LONG_LONG_MAX__
117 #define __LONG_LONG_MAX__ 9223372036854775807LL
118 #endif
119 #undef LONG_LONG_MIN
120 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
121 #undef LONG_LONG_MAX
122 #define LONG_LONG_MAX __LONG_LONG_MAX__
123
124 /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
125 #undef ULONG_LONG_MAX
126 #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
127 #endif
128
129 #endif /* _MACH_MACHLIMITS_H_ */
130 #endif /* _LIMITS_H___ */