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