]> git.sesse.net Git - casparcg/blob - ffmpeg 0.5/include/stdint.h
2.0.2: INFO TEMPLATE works on both compressed and uncompressed templates.
[casparcg] / ffmpeg 0.5 / include / stdint.h
1 // ISO C9x  compliant stdint.h for Microsoft Visual Studio\r
2 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 \r
3 // \r
4 //  Copyright (c) 2006-2008 Alexander Chemeris\r
5 // \r
6 // Redistribution and use in source and binary forms, with or without\r
7 // modification, are permitted provided that the following conditions are met:\r
8 // \r
9 //   1. Redistributions of source code must retain the above copyright notice,\r
10 //      this list of conditions and the following disclaimer.\r
11 // \r
12 //   2. Redistributions in binary form must reproduce the above copyright\r
13 //      notice, this list of conditions and the following disclaimer in the\r
14 //      documentation and/or other materials provided with the distribution.\r
15 // \r
16 //   3. The name of the author may be used to endorse or promote products\r
17 //      derived from this software without specific prior written permission.\r
18 // \r
19 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED\r
20 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\r
22 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \r
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
29 // \r
30 ///////////////////////////////////////////////////////////////////////////////\r
31 \r
32 #ifndef _MSC_VER // [\r
33 #error "Use this header only with Microsoft Visual C++ compilers!"\r
34 #endif // _MSC_VER ]\r
35 \r
36 #ifndef _MSC_STDINT_H_ // [\r
37 #define _MSC_STDINT_H_\r
38 \r
39 #if _MSC_VER > 1000\r
40 #pragma once\r
41 #endif\r
42 \r
43 #include <limits.h>\r
44 \r
45 // For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'\r
46 // or compiler give many errors like this:\r
47 //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed\r
48 #if (_MSC_VER < 1300) && defined(__cplusplus)\r
49    extern "C++" {\r
50 #endif \r
51 #     include <wchar.h>\r
52 #if (_MSC_VER < 1300) && defined(__cplusplus)\r
53    }\r
54 #endif\r
55 \r
56 // Define _W64 macros to mark types changing their size, like intptr_t.\r
57 #ifndef _W64\r
58 #  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300\r
59 #     define _W64 __w64\r
60 #  else\r
61 #     define _W64\r
62 #  endif\r
63 #endif\r
64 \r
65 \r
66 // 7.18.1 Integer types\r
67 \r
68 // 7.18.1.1 Exact-width integer types\r
69 typedef __int8            int8_t;\r
70 typedef __int16           int16_t;\r
71 typedef __int32           int32_t;\r
72 typedef __int64           int64_t;\r
73 typedef unsigned __int8   uint8_t;\r
74 typedef unsigned __int16  uint16_t;\r
75 typedef unsigned __int32  uint32_t;\r
76 typedef unsigned __int64  uint64_t;\r
77 \r
78 // 7.18.1.2 Minimum-width integer types\r
79 typedef int8_t    int_least8_t;\r
80 typedef int16_t   int_least16_t;\r
81 typedef int32_t   int_least32_t;\r
82 typedef int64_t   int_least64_t;\r
83 typedef uint8_t   uint_least8_t;\r
84 typedef uint16_t  uint_least16_t;\r
85 typedef uint32_t  uint_least32_t;\r
86 typedef uint64_t  uint_least64_t;\r
87 \r
88 // 7.18.1.3 Fastest minimum-width integer types\r
89 typedef int8_t    int_fast8_t;\r
90 typedef int16_t   int_fast16_t;\r
91 typedef int32_t   int_fast32_t;\r
92 typedef int64_t   int_fast64_t;\r
93 typedef uint8_t   uint_fast8_t;\r
94 typedef uint16_t  uint_fast16_t;\r
95 typedef uint32_t  uint_fast32_t;\r
96 typedef uint64_t  uint_fast64_t;\r
97 \r
98 // 7.18.1.4 Integer types capable of holding object pointers\r
99 #ifdef _WIN64 // [\r
100    typedef __int64           intptr_t;\r
101    typedef unsigned __int64  uintptr_t;\r
102 #else // _WIN64 ][\r
103    typedef _W64 int               intptr_t;\r
104    typedef _W64 unsigned int      uintptr_t;\r
105 #endif // _WIN64 ]\r
106 \r
107 // 7.18.1.5 Greatest-width integer types\r
108 typedef int64_t   intmax_t;\r
109 typedef uint64_t  uintmax_t;\r
110 \r
111 \r
112 // 7.18.2 Limits of specified-width integer types\r
113 \r
114 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259\r
115 \r
116 // 7.18.2.1 Limits of exact-width integer types\r
117 #define INT8_MIN     ((int8_t)_I8_MIN)\r
118 #define INT8_MAX     _I8_MAX\r
119 #define INT16_MIN    ((int16_t)_I16_MIN)\r
120 #define INT16_MAX    _I16_MAX\r
121 #define INT32_MIN    ((int32_t)_I32_MIN)\r
122 #define INT32_MAX    _I32_MAX\r
123 #define INT64_MIN    ((int64_t)_I64_MIN)\r
124 #define INT64_MAX    _I64_MAX\r
125 #define UINT8_MAX    _UI8_MAX\r
126 #define UINT16_MAX   _UI16_MAX\r
127 #define UINT32_MAX   _UI32_MAX\r
128 #define UINT64_MAX   _UI64_MAX\r
129 \r
130 // 7.18.2.2 Limits of minimum-width integer types\r
131 #define INT_LEAST8_MIN    INT8_MIN\r
132 #define INT_LEAST8_MAX    INT8_MAX\r
133 #define INT_LEAST16_MIN   INT16_MIN\r
134 #define INT_LEAST16_MAX   INT16_MAX\r
135 #define INT_LEAST32_MIN   INT32_MIN\r
136 #define INT_LEAST32_MAX   INT32_MAX\r
137 #define INT_LEAST64_MIN   INT64_MIN\r
138 #define INT_LEAST64_MAX   INT64_MAX\r
139 #define UINT_LEAST8_MAX   UINT8_MAX\r
140 #define UINT_LEAST16_MAX  UINT16_MAX\r
141 #define UINT_LEAST32_MAX  UINT32_MAX\r
142 #define UINT_LEAST64_MAX  UINT64_MAX\r
143 \r
144 // 7.18.2.3 Limits of fastest minimum-width integer types\r
145 #define INT_FAST8_MIN    INT8_MIN\r
146 #define INT_FAST8_MAX    INT8_MAX\r
147 #define INT_FAST16_MIN   INT16_MIN\r
148 #define INT_FAST16_MAX   INT16_MAX\r
149 #define INT_FAST32_MIN   INT32_MIN\r
150 #define INT_FAST32_MAX   INT32_MAX\r
151 #define INT_FAST64_MIN   INT64_MIN\r
152 #define INT_FAST64_MAX   INT64_MAX\r
153 #define UINT_FAST8_MAX   UINT8_MAX\r
154 #define UINT_FAST16_MAX  UINT16_MAX\r
155 #define UINT_FAST32_MAX  UINT32_MAX\r
156 #define UINT_FAST64_MAX  UINT64_MAX\r
157 \r
158 // 7.18.2.4 Limits of integer types capable of holding object pointers\r
159 #ifdef _WIN64 // [\r
160 #  define INTPTR_MIN   INT64_MIN\r
161 #  define INTPTR_MAX   INT64_MAX\r
162 #  define UINTPTR_MAX  UINT64_MAX\r
163 #else // _WIN64 ][\r
164 #  define INTPTR_MIN   INT32_MIN\r
165 #  define INTPTR_MAX   INT32_MAX\r
166 #  define UINTPTR_MAX  UINT32_MAX\r
167 #endif // _WIN64 ]\r
168 \r
169 // 7.18.2.5 Limits of greatest-width integer types\r
170 #define INTMAX_MIN   INT64_MIN\r
171 #define INTMAX_MAX   INT64_MAX\r
172 #define UINTMAX_MAX  UINT64_MAX\r
173 \r
174 // 7.18.3 Limits of other integer types\r
175 \r
176 #ifdef _WIN64 // [\r
177 #  define PTRDIFF_MIN  _I64_MIN\r
178 #  define PTRDIFF_MAX  _I64_MAX\r
179 #else  // _WIN64 ][\r
180 #  define PTRDIFF_MIN  _I32_MIN\r
181 #  define PTRDIFF_MAX  _I32_MAX\r
182 #endif  // _WIN64 ]\r
183 \r
184 #define SIG_ATOMIC_MIN  INT_MIN\r
185 #define SIG_ATOMIC_MAX  INT_MAX\r
186 \r
187 #ifndef SIZE_MAX // [\r
188 #  ifdef _WIN64 // [\r
189 #     define SIZE_MAX  _UI64_MAX\r
190 #  else // _WIN64 ][\r
191 #     define SIZE_MAX  _UI32_MAX\r
192 #  endif // _WIN64 ]\r
193 #endif // SIZE_MAX ]\r
194 \r
195 // WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>\r
196 #ifndef WCHAR_MIN // [\r
197 #  define WCHAR_MIN  0\r
198 #endif  // WCHAR_MIN ]\r
199 #ifndef WCHAR_MAX // [\r
200 #  define WCHAR_MAX  _UI16_MAX\r
201 #endif  // WCHAR_MAX ]\r
202 \r
203 #define WINT_MIN  0\r
204 #define WINT_MAX  _UI16_MAX\r
205 \r
206 #endif // __STDC_LIMIT_MACROS ]\r
207 \r
208 \r
209 // 7.18.4 Limits of other integer types\r
210 \r
211 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260\r
212 \r
213 // 7.18.4.1 Macros for minimum-width integer constants\r
214 \r
215 #define INT8_C(val)  val##i8\r
216 #define INT16_C(val) val##i16\r
217 #define INT32_C(val) val##i32\r
218 #define INT64_C(val) val##i64\r
219 \r
220 #define UINT8_C(val)  val##ui8\r
221 #define UINT16_C(val) val##ui16\r
222 #define UINT32_C(val) val##ui32\r
223 #define UINT64_C(val) val##ui64\r
224 \r
225 // 7.18.4.2 Macros for greatest-width integer constants\r
226 #define INTMAX_C   INT64_C\r
227 #define UINTMAX_C  UINT64_C\r
228 \r
229 #endif // __STDC_CONSTANT_MACROS ]\r
230 \r
231 \r
232 #endif // _MSC_STDINT_H_ ]\r