]>
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.
67 /* 7.18.2.1 Limits of exact-width integer types */
69 #define INT16_MAX 32767
70 #define INT32_MAX 2147483647
71 #define INT64_MAX 9223372036854775807LL
74 #define INT16_MIN -32768
76 Note: the literal "most negative int" cannot be written in C --
77 the rules in the standard (section 6.4.4.1 in C99) will give it
78 an unsigned type, so INT32_MIN (and the most negative member of
79 any larger signed type) must be written via a constant expression.
81 #define INT32_MIN (-INT32_MAX-1)
82 #define INT64_MIN (-INT64_MAX-1)
85 #define UINT16_MAX 65535
86 #define UINT32_MAX 4294967295U
87 #define UINT64_MAX 18446744073709551615ULL
89 /* 7.18.2.2 Limits of minimum-width integer types */
90 #define INT_LEAST8_MIN INT8_MIN
91 #define INT_LEAST16_MIN INT16_MIN
92 #define INT_LEAST32_MIN INT32_MIN
93 #define INT_LEAST64_MIN INT64_MIN
95 #define INT_LEAST8_MAX INT8_MAX
96 #define INT_LEAST16_MAX INT16_MAX
97 #define INT_LEAST32_MAX INT32_MAX
98 #define INT_LEAST64_MAX INT64_MAX
100 #define UINT_LEAST8_MAX UINT8_MAX
101 #define UINT_LEAST16_MAX UINT16_MAX
102 #define UINT_LEAST32_MAX UINT32_MAX
103 #define UINT_LEAST64_MAX UINT64_MAX
105 /* 7.18.2.3 Limits of fastest minimum-width integer types */
106 #define INT_FAST8_MIN INT8_MIN
107 #define INT_FAST16_MIN INT16_MIN
108 #define INT_FAST32_MIN INT32_MIN
109 #define INT_FAST64_MIN INT64_MIN
111 #define INT_FAST8_MAX INT8_MAX
112 #define INT_FAST16_MAX INT16_MAX
113 #define INT_FAST32_MAX INT32_MAX
114 #define INT_FAST64_MAX INT64_MAX
116 #define UINT_FAST8_MAX UINT8_MAX
117 #define UINT_FAST16_MAX UINT16_MAX
118 #define UINT_FAST32_MAX UINT32_MAX
119 #define UINT_FAST64_MAX UINT64_MAX
121 /* 7.18.2.4 Limits of integer types capable of holding object pointers */
124 #define INTPTR_MIN INT64_MIN
125 #define INTPTR_MAX INT64_MAX
127 #define INTPTR_MIN INT32_MIN
128 #define INTPTR_MAX INT32_MAX
132 #define UINTPTR_MAX UINT64_MAX
134 #define UINTPTR_MAX UINT32_MAX
137 /* 7.18.2.5 Limits of greatest-width integer types */
138 #define INTMAX_MIN INT64_MIN
139 #define INTMAX_MAX INT64_MAX
141 #define UINTMAX_MAX UINT64_MAX
145 #define PTRDIFF_MIN INT64_MIN
146 #define PTRDIFF_MAX INT64_MAX
148 #define PTRDIFF_MIN INT32_MIN
149 #define PTRDIFF_MAX INT32_MAX
152 /* We have no sig_atomic_t yet, so no SIG_ATOMIC_{MIN,MAX}.
153 Should end up being {-127,127} or {0,255} ... or bigger.
154 My bet would be on one of {U}INT32_{MIN,MAX}. */
157 #define SIZE_MAX UINT64_MAX
159 #define SIZE_MAX UINT32_MAX
162 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
163 #define RSIZE_MAX (SIZE_MAX >> 1)
167 # ifdef __WCHAR_MAX__
168 # define WCHAR_MAX __WCHAR_MAX__
170 # define WCHAR_MAX 0x7fffffff
174 /* WCHAR_MIN should be 0 if wchar_t is an unsigned type and
175 (-WCHAR_MAX-1) if wchar_t is a signed type. Unfortunately,
176 it turns out that -fshort-wchar changes the signedness of
179 # if WCHAR_MAX == 0xffff
182 # define WCHAR_MIN (-WCHAR_MAX-1)
186 #define WINT_MIN INT32_MIN
187 #define WINT_MAX INT32_MAX
189 #define SIG_ATOMIC_MIN INT32_MIN
190 #define SIG_ATOMIC_MAX INT32_MAX
192 /* 7.18.4 Macros for integer constants */
193 #define INT8_C(v) (v)
194 #define INT16_C(v) (v)
195 #define INT32_C(v) (v)
196 #define INT64_C(v) (v ## LL)
198 #define UINT8_C(v) (v ## U)
199 #define UINT16_C(v) (v ## U)
200 #define UINT32_C(v) (v ## U)
201 #define UINT64_C(v) (v ## ULL)
204 #define INTMAX_C(v) (v ## L)
205 #define UINTMAX_C(v) (v ## UL)
207 #define INTMAX_C(v) (v ## LL)
208 #define UINTMAX_C(v) (v ## ULL)
211 #endif /* _STDINT_H_ */