]>
git.saurik.com Git - apple/libc.git/blob - include/stdint.h
2 * Copyright (c) 2000-2010 Apple Inc.
15 /* from ISO/IEC 988:1999 spec */
17 /* 7.18.1.1 Exact-width integer types */
18 #include <sys/_types/_int8_t.h>
19 #include <sys/_types/_int16_t.h>
20 #include <sys/_types/_int32_t.h>
21 #include <sys/_types/_int64_t.h>
23 #include <_types/_uint8_t.h>
24 #include <_types/_uint16_t.h>
25 #include <_types/_uint32_t.h>
26 #include <_types/_uint64_t.h>
28 /* 7.18.1.2 Minimum-width integer types */
29 typedef int8_t int_least8_t;
30 typedef int16_t int_least16_t;
31 typedef int32_t int_least32_t;
32 typedef int64_t int_least64_t;
33 typedef uint8_t uint_least8_t;
34 typedef uint16_t uint_least16_t;
35 typedef uint32_t uint_least32_t;
36 typedef uint64_t uint_least64_t;
39 /* 7.18.1.3 Fastest-width integer types */
40 typedef int8_t int_fast8_t;
41 typedef int16_t int_fast16_t;
42 typedef int32_t int_fast32_t;
43 typedef int64_t int_fast64_t;
44 typedef uint8_t uint_fast8_t;
45 typedef uint16_t uint_fast16_t;
46 typedef uint32_t uint_fast32_t;
47 typedef uint64_t uint_fast64_t;
50 /* 7.18.1.4 Integer types capable of holding object pointers */
52 #include <sys/_types.h>
53 #include <sys/_types/_intptr_t.h>
54 #include <sys/_types/_uintptr_t.h>
57 /* 7.18.1.5 Greatest-width integer types */
58 #include <_types/_intmax_t.h>
59 #include <_types/_uintmax_t.h>
61 /* 7.18.4 Macros for integer constants */
63 #define INT16_C(v) (v)
64 #define INT32_C(v) (v)
65 #define INT64_C(v) (v ## LL)
67 #define UINT8_C(v) (v)
68 #define UINT16_C(v) (v)
69 #define UINT32_C(v) (v ## U)
70 #define UINT64_C(v) (v ## ULL)
73 #define INTMAX_C(v) (v ## L)
74 #define UINTMAX_C(v) (v ## UL)
76 #define INTMAX_C(v) (v ## LL)
77 #define UINTMAX_C(v) (v ## ULL)
80 /* 7.18.2 Limits of specified-width integer types:
81 * These #defines specify the minimum and maximum limits
82 * of each of the types declared above.
84 * They must have "the same type as would an expression that is an
85 * object of the corresponding type converted according to the integer
90 /* 7.18.2.1 Limits of exact-width integer types */
92 #define INT16_MAX 32767
93 #define INT32_MAX 2147483647
94 #define INT64_MAX 9223372036854775807LL
97 #define INT16_MIN -32768
99 Note: the literal "most negative int" cannot be written in C --
100 the rules in the standard (section 6.4.4.1 in C99) will give it
101 an unsigned type, so INT32_MIN (and the most negative member of
102 any larger signed type) must be written via a constant expression.
104 #define INT32_MIN (-INT32_MAX-1)
105 #define INT64_MIN (-INT64_MAX-1)
107 #define UINT8_MAX 255
108 #define UINT16_MAX 65535
109 #define UINT32_MAX 4294967295U
110 #define UINT64_MAX 18446744073709551615ULL
112 /* 7.18.2.2 Limits of minimum-width integer types */
113 #define INT_LEAST8_MIN INT8_MIN
114 #define INT_LEAST16_MIN INT16_MIN
115 #define INT_LEAST32_MIN INT32_MIN
116 #define INT_LEAST64_MIN INT64_MIN
118 #define INT_LEAST8_MAX INT8_MAX
119 #define INT_LEAST16_MAX INT16_MAX
120 #define INT_LEAST32_MAX INT32_MAX
121 #define INT_LEAST64_MAX INT64_MAX
123 #define UINT_LEAST8_MAX UINT8_MAX
124 #define UINT_LEAST16_MAX UINT16_MAX
125 #define UINT_LEAST32_MAX UINT32_MAX
126 #define UINT_LEAST64_MAX UINT64_MAX
128 /* 7.18.2.3 Limits of fastest minimum-width integer types */
129 #define INT_FAST8_MIN INT8_MIN
130 #define INT_FAST16_MIN INT16_MIN
131 #define INT_FAST32_MIN INT32_MIN
132 #define INT_FAST64_MIN INT64_MIN
134 #define INT_FAST8_MAX INT8_MAX
135 #define INT_FAST16_MAX INT16_MAX
136 #define INT_FAST32_MAX INT32_MAX
137 #define INT_FAST64_MAX INT64_MAX
139 #define UINT_FAST8_MAX UINT8_MAX
140 #define UINT_FAST16_MAX UINT16_MAX
141 #define UINT_FAST32_MAX UINT32_MAX
142 #define UINT_FAST64_MAX UINT64_MAX
144 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
147 #define INTPTR_MAX 9223372036854775807L
149 #define INTPTR_MAX 2147483647L
151 #define INTPTR_MIN (-INTPTR_MAX-1)
154 #define UINTPTR_MAX 18446744073709551615UL
156 #define UINTPTR_MAX 4294967295UL
159 /* 7.18.2.5 Limits of greatest-width integer types */
160 #define INTMAX_MAX INTMAX_C(9223372036854775807)
161 #define UINTMAX_MAX UINTMAX_C(18446744073709551615)
162 #define INTMAX_MIN (-INTMAX_MAX-1)
166 #define PTRDIFF_MIN INTMAX_MIN
167 #define PTRDIFF_MAX INTMAX_MAX
169 #define PTRDIFF_MIN INT32_MIN
170 #define PTRDIFF_MAX INT32_MAX
173 #define SIZE_MAX UINTPTR_MAX
175 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
176 #define RSIZE_MAX (SIZE_MAX >> 1)
180 # ifdef __WCHAR_MAX__
181 # define WCHAR_MAX __WCHAR_MAX__
183 # define WCHAR_MAX 0x7fffffff
187 /* WCHAR_MIN should be 0 if wchar_t is an unsigned type and
188 (-WCHAR_MAX-1) if wchar_t is a signed type. Unfortunately,
189 it turns out that -fshort-wchar changes the signedness of
192 # if WCHAR_MAX == 0xffff
195 # define WCHAR_MIN (-WCHAR_MAX-1)
199 #define WINT_MIN INT32_MIN
200 #define WINT_MAX INT32_MAX
202 #define SIG_ATOMIC_MIN INT32_MIN
203 #define SIG_ATOMIC_MAX INT32_MAX
205 #endif /* _STDINT_H_ */