2 Copyright (C) 2014 Waves Audio Ltd.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include </usr/include/stdint.h> // Mac has this file in /usr/includez
33 #if ! defined(__STDC_LIMIT_MACROS)
34 #define __STDC_LIMIT_MACROS
38 #include </usr/include/stdint.h>
41 #if (defined (PLATFORM_WINDOWS) || defined(WIN32) || defined(WIN64))
42 #if (_MSC_VER > 1600) || defined(__MINGW64__) || defined(__MINGW32__)
43 // Taken from MSDN official page:
44 // In Visual Studio 2010 _MSC_VER is defined as 1600, In Visual Studio 2012 _MSC_VER is defined as 1700.
48 #define _STDINT_H // this will prevent Altura's CGBase.h from defining int32_t
51 * ISO C 99 <stdint.h> for platforms that lack it.
52 * <http://www.opengroup.org/onlinepubs/007904975/basedefs/stdint.h.html>
55 /* Get wchar_t, WCHAR_MIN, WCHAR_MAX. */
57 /* Get CHAR_BIT, LONG_MIN, LONG_MAX, ULONG_MAX. */
60 /* Get those types that are already defined in other system include files. */
61 #if defined(__FreeBSD__)
62 # include <sys/inttypes.h>
65 #if defined(__sun) && HAVE_SYS_INTTYPES_H
66 # include <sys/inttypes.h>
67 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
68 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
69 But note that <sys/int_types.h> contains only the type definitions! */
70 # define HAVE_SYSTEM_INTTYPES
72 #if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
73 # include <inttypes.h>
74 /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
75 UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
76 /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
77 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
78 # define HAVE_SYSTEM_INTTYPES
80 #if !(defined(UNIX_CYGWIN32) && defined(__BIT_TYPES_DEFINED__))
81 # define NEED_SIGNED_INT_TYPES
84 #if !defined(HAVE_SYSTEM_INTTYPES)
86 /* 7.18.1.1. Exact-width integer types */
87 #if !defined(__FreeBSD__)
90 #ifndef __int8_t_defined
91 #define __int8_t_defined
92 typedef __int8 int8_t;
93 typedef unsigned __int8 uint8_t;
94 typedef __int16 int16_t;
95 typedef unsigned __int16 uint16_t;
96 typedef __int32 int32_t;
97 typedef unsigned __int32 uint32_t;
98 typedef __int64 int64_t;
99 typedef unsigned __int64 uint64_t;
104 #ifdef NEED_SIGNED_INT_TYPES
105 typedef signed char int8_t;
107 typedef unsigned char uint8_t;
109 #ifdef NEED_SIGNED_INT_TYPES
110 typedef short int16_t;
112 typedef unsigned short uint16_t;
114 #ifdef NEED_SIGNED_INT_TYPES
117 typedef unsigned int uint32_t;
120 #ifdef NEED_SIGNED_INT_TYPES
121 typedef long int64_t;
123 typedef unsigned long uint64_t;
125 #ifdef NEED_SIGNED_INT_TYPES
126 typedef long long int64_t;
128 typedef unsigned long long uint64_t;
133 #endif /* !FreeBSD */
135 /* 7.18.1.2. Minimum-width integer types */
137 typedef int8_t int_least8_t;
138 typedef uint8_t uint_least8_t;
139 typedef int16_t int_least16_t;
140 typedef uint16_t uint_least16_t;
141 #if !defined(kAlturaAlreadyDefinesInt32)
142 typedef int32_t int_least32_t;
144 typedef uint32_t uint_least32_t;
145 typedef int64_t int_least64_t;
146 typedef uint64_t uint_least64_t;
149 /* 7.18.1.3. Fastest minimum-width integer types */
152 typedef int32_t int_fast8_t;
153 typedef uint32_t uint_fast8_t;
154 typedef int32_t int_fast16_t;
155 typedef uint32_t uint_fast16_t;
156 typedef int32_t int_fast32_t;
157 typedef uint32_t uint_fast32_t;
158 typedef int64_t int_fast64_t;
159 typedef uint64_t uint_fast64_t;
163 /* 7.18.1.4. Integer types capable of holding object pointers */
165 #if !defined(__FreeBSD__)
167 /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
168 but this doesn't matter here. */
169 #if !defined(_INTPTR_T_DEFINED)
170 typedef long intptr_t;
171 #define _INTPTR_T_DEFINED
173 #if !defined(_UINTPTR_T_DEFINED)
174 typedef unsigned long uintptr_t;
175 #define _UINTPTR_T_DEFINED
178 #endif /* !FreeBSD */
180 /* 7.18.1.5. Greatest-width integer types */
183 typedef int64_t intmax_t;
184 typedef uint64_t uintmax_t;
186 typedef int32_t intmax_t;
187 typedef uint32_t uintmax_t;
190 /* 7.18.2. Limits of specified-width integer types */
192 //#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
194 /* 7.18.2.1. Limits of exact-width integer types */
198 #define INT8_MIN -128
200 #define UINT8_MAX 255U
201 #define INT16_MIN -32768
202 #define INT16_MAX 32767
203 #define UINT16_MAX 65535U
204 #define INT32_MIN (~INT32_MAX)
205 #define INT32_MAX 2147483647
206 #define UINT32_MAX 4294967295U
208 #define INT64_MIN (~INT64_MIN)
209 #define INT64_MAX 9223372036854775807L
210 #define UINT64_MAX 18446744073709551615UL
212 #define INT64_MIN (~INT64_MIN)
213 #define INT64_MAX 9223372036854775807LL
214 #define UINT64_MAX 18446744073709551615ULL
217 /* 7.18.2.2. Limits of minimum-width integer types */
219 #define INT_LEAST8_MIN INT8_MIN
220 #define INT_LEAST8_MAX INT8_MAX
221 #define UINT_LEAST8_MAX UINT8_MAX
222 #define INT_LEAST16_MIN INT16_MIN
223 #define INT_LEAST16_MAX INT16_MAX
224 #define UINT_LEAST16_MAX UINT16_MAX
225 #define INT_LEAST32_MIN INT32_MIN
226 #define INT_LEAST32_MAX INT32_MAX
227 #define UINT_LEAST32_MAX UINT32_MAX
229 #define INT_LEAST64_MIN INT64_MIN
230 #define INT_LEAST64_MAX INT64_MAX
231 #define UINT_LEAST64_MAX UINT64_MAX
234 /* 7.18.2.3. Limits of fastest minimum-width integer types */
236 #define INT_FAST8_MIN INT32_MIN
237 #define INT_FAST8_MAX INT32_MAX
238 #define UINT_FAST8_MAX UINT32_MAX
239 #define INT_FAST16_MIN INT32_MIN
240 #define INT_FAST16_MAX INT32_MAX
241 #define UINT_FAST16_MAX UINT32_MAX
242 #define INT_FAST32_MIN INT32_MIN
243 #define INT_FAST32_MAX INT32_MAX
244 #define UINT_FAST32_MAX UINT32_MAX
246 #define INT_FAST64_MIN INT64_MIN
247 #define INT_FAST64_MAX INT64_MAX
248 #define UINT_FAST64_MAX UINT64_MAX
251 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
253 #define INTPTR_MIN LONG_MIN
254 #define INTPTR_MAX LONG_MAX
255 #define UINTPTR_MAX ULONG_MAX
257 /* 7.18.2.5. Limits of greatest-width integer types */
260 #define INTMAX_MIN INT64_MIN
261 #define INTMAX_MAX INT64_MAX
262 #define UINTMAX_MAX UINT64_MAX
264 #define INTMAX_MIN INT32_MIN
265 #define INTMAX_MAX INT32_MAX
266 #define UINTMAX_MAX UINT32_MAX
269 /* 7.18.3. Limits of other integer types */
271 #define PTRDIFF_MIN (~(ptrdiff_t)0 << (sizeof(ptrdiff_t)*CHAR_BIT-1))
272 #define PTRDIFF_MAX (~PTRDIFF_MIN)
274 /* This may be wrong... */
275 #define SIG_ATOMIC_MIN 0
276 #define SIG_ATOMIC_MAX 127
278 #endif /* _STDINT_H */
280 //#define SIZE_MAX (~(size_t)0)
282 /* wchar_t limits already defined in <stddef.h>. */
283 /* wint_t limits already defined in <wchar.h>. */
287 /* 7.18.4. Macros for integer constants */
289 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
291 /* 7.18.4.1. Macros for minimum-width integer constants */
301 #define UINT8_C(x) x##U
311 #define UINT16_C(x) x##U
321 #define UINT32_C(x) x##U
323 // INT64_C and UINT64_C definitions
331 #define INT64_C(x) x##L
332 #define UINT64_C(x) x##UL
334 #define INT64_C(x) x##LL
335 #define UINT64_C(x) x##ULL
338 /* 7.18.4.2. Macros for greatest-width integer constants */
340 // INTMAX_C and UINTMAX_C definitions
349 #define INTMAX_C(x) x##L
350 #define UINTMAX_C(x) x##UL
352 #define INTMAX_C(x) x##LL
353 #define UINTMAX_C(x) x##ULL
355 #define INTMAX_C(x) x
356 #define UINTMAX_C(x) x##U
361 #endif /* !HAVE_SYSTEM_INTTYPES */
363 #endif /* (_MSC_VER < 1400) */
365 #endif /* #ifdef PLATFORM_WINDOWS */
367 #endif /* __stdint_h__ */