]>
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.2 Limits of specified-width integer types:
62 * These #defines specify the minimum and maximum limits
63 * of each of the types declared above.
65 * They must have "the same type as would an expression that is an
66 * object of the corresponding type converted according to the integer
71 /* 7.18.2.1 Limits of exact-width integer types */
73 #define INT16_MAX 32767
74 #define INT32_MAX 2147483647
75 #define INT64_MAX 9223372036854775807LL
78 #define INT16_MIN -32768
80 Note: the literal "most negative int" cannot be written in C --
81 the rules in the standard (section 6.4.4.1 in C99) will give it
82 an unsigned type, so INT32_MIN (and the most negative member of
83 any larger signed type) must be written via a constant expression.
85 #define INT32_MIN (-INT32_MAX-1)
86 #define INT64_MIN (-INT64_MAX-1)
89 #define UINT16_MAX 65535
90 #define UINT32_MAX 4294967295U
91 #define UINT64_MAX 18446744073709551615ULL
93 /* 7.18.2.2 Limits of minimum-width integer types */
94 #define INT_LEAST8_MIN INT8_MIN
95 #define INT_LEAST16_MIN INT16_MIN
96 #define INT_LEAST32_MIN INT32_MIN
97 #define INT_LEAST64_MIN INT64_MIN
99 #define INT_LEAST8_MAX INT8_MAX
100 #define INT_LEAST16_MAX INT16_MAX
101 #define INT_LEAST32_MAX INT32_MAX
102 #define INT_LEAST64_MAX INT64_MAX
104 #define UINT_LEAST8_MAX UINT8_MAX
105 #define UINT_LEAST16_MAX UINT16_MAX
106 #define UINT_LEAST32_MAX UINT32_MAX
107 #define UINT_LEAST64_MAX UINT64_MAX
109 /* 7.18.2.3 Limits of fastest minimum-width integer types */
110 #define INT_FAST8_MIN INT8_MIN
111 #define INT_FAST16_MIN INT16_MIN
112 #define INT_FAST32_MIN INT32_MIN
113 #define INT_FAST64_MIN INT64_MIN
115 #define INT_FAST8_MAX INT8_MAX
116 #define INT_FAST16_MAX INT16_MAX
117 #define INT_FAST32_MAX INT32_MAX
118 #define INT_FAST64_MAX INT64_MAX
120 #define UINT_FAST8_MAX UINT8_MAX
121 #define UINT_FAST16_MAX UINT16_MAX
122 #define UINT_FAST32_MAX UINT32_MAX
123 #define UINT_FAST64_MAX UINT64_MAX
125 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
128 #define INTPTR_MAX 9223372036854775807L
130 #define INTPTR_MAX 2147483647L
132 #define INTPTR_MIN (-INTPTR_MAX-1)
135 #define UINTPTR_MAX 18446744073709551615UL
137 #define UINTPTR_MAX 4294967295UL
140 /* 7.18.2.5 Limits of greatest-width integer types */
141 #define INTMAX_MIN INT64_MIN
142 #define INTMAX_MAX INT64_MAX
144 #define UINTMAX_MAX UINT64_MAX
148 #define PTRDIFF_MIN INT64_MIN
149 #define PTRDIFF_MAX INT64_MAX
151 #define PTRDIFF_MIN INT32_MIN
152 #define PTRDIFF_MAX INT32_MAX
155 #define SIZE_MAX UINTPTR_MAX
157 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
158 #define RSIZE_MAX (SIZE_MAX >> 1)
162 # ifdef __WCHAR_MAX__
163 # define WCHAR_MAX __WCHAR_MAX__
165 # define WCHAR_MAX 0x7fffffff
169 /* WCHAR_MIN should be 0 if wchar_t is an unsigned type and
170 (-WCHAR_MAX-1) if wchar_t is a signed type. Unfortunately,
171 it turns out that -fshort-wchar changes the signedness of
174 # if WCHAR_MAX == 0xffff
177 # define WCHAR_MIN (-WCHAR_MAX-1)
181 #define WINT_MIN INT32_MIN
182 #define WINT_MAX INT32_MAX
184 #define SIG_ATOMIC_MIN INT32_MIN
185 #define SIG_ATOMIC_MAX INT32_MAX
187 /* 7.18.4 Macros for integer constants */
188 #define INT8_C(v) (v)
189 #define INT16_C(v) (v)
190 #define INT32_C(v) (v)
191 #define INT64_C(v) (v ## LL)
193 #define UINT8_C(v) (v)
194 #define UINT16_C(v) (v)
195 #define UINT32_C(v) (v ## U)
196 #define UINT64_C(v) (v ## ULL)
199 #define INTMAX_C(v) (v ## L)
200 #define UINTMAX_C(v) (v ## UL)
202 #define INTMAX_C(v) (v ## LL)
203 #define UINTMAX_C(v) (v ## ULL)
206 #endif /* _STDINT_H_ */