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