rev |
line source |
nuclear@3
|
1 /************************************************************************************
|
nuclear@3
|
2
|
nuclear@3
|
3 PublicHeader: OVR.h
|
nuclear@3
|
4 Filename : OVR_Types.h
|
nuclear@3
|
5 Content : Standard library defines and simple types
|
nuclear@3
|
6 Created : September 19, 2012
|
nuclear@3
|
7 Notes :
|
nuclear@3
|
8
|
nuclear@3
|
9 Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved.
|
nuclear@3
|
10
|
nuclear@3
|
11 Use of this software is subject to the terms of the Oculus license
|
nuclear@3
|
12 agreement provided at the time of installation or download, or which
|
nuclear@3
|
13 otherwise accompanies this software in either electronic or hard copy form.
|
nuclear@3
|
14
|
nuclear@3
|
15 ************************************************************************************/
|
nuclear@3
|
16
|
nuclear@3
|
17 #ifndef OVR_Types_H
|
nuclear@3
|
18 #define OVR_Types_H
|
nuclear@3
|
19
|
nuclear@3
|
20 //-----------------------------------------------------------------------------------
|
nuclear@3
|
21 // ****** Operating System
|
nuclear@3
|
22 //
|
nuclear@3
|
23 // Type definitions exist for the following operating systems: (OVR_OS_x)
|
nuclear@3
|
24 //
|
nuclear@3
|
25 // WIN32 - Win32 (Windows 95/98/ME and Windows NT/2000/XP)
|
nuclear@3
|
26 // DARWIN - Darwin OS (Mac OS X)
|
nuclear@3
|
27 // LINUX - Linux
|
nuclear@3
|
28 // ANDROID - Android
|
nuclear@3
|
29 // IPHONE - iPhone
|
nuclear@3
|
30
|
nuclear@3
|
31 #if (defined(__APPLE__) && (defined(__GNUC__) ||\
|
nuclear@3
|
32 defined(__xlC__) || defined(__xlc__))) || defined(__MACOS__)
|
nuclear@3
|
33 # if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED))
|
nuclear@3
|
34 # define OVR_OS_IPHONE
|
nuclear@3
|
35 # else
|
nuclear@3
|
36 # define OVR_OS_DARWIN
|
nuclear@3
|
37 # define OVR_OS_MAC
|
nuclear@3
|
38 # endif
|
nuclear@3
|
39 #elif (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
|
nuclear@3
|
40 # define OVR_OS_WIN32
|
nuclear@3
|
41 #elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
|
nuclear@3
|
42 # define OVR_OS_WIN32
|
nuclear@3
|
43 #elif defined(__linux__) || defined(__linux)
|
nuclear@3
|
44 # define OVR_OS_LINUX
|
nuclear@3
|
45 #else
|
nuclear@3
|
46 # define OVR_OS_OTHER
|
nuclear@3
|
47 #endif
|
nuclear@3
|
48
|
nuclear@3
|
49 #if defined(ANDROID)
|
nuclear@3
|
50 # define OVR_OS_ANDROID
|
nuclear@3
|
51 #endif
|
nuclear@3
|
52
|
nuclear@3
|
53
|
nuclear@3
|
54 //-----------------------------------------------------------------------------------
|
nuclear@3
|
55 // ***** CPU Architecture
|
nuclear@3
|
56 //
|
nuclear@3
|
57 // The following CPUs are defined: (OVR_CPU_x)
|
nuclear@3
|
58 //
|
nuclear@3
|
59 // X86 - x86 (IA-32)
|
nuclear@3
|
60 // X86_64 - x86_64 (amd64)
|
nuclear@3
|
61 // PPC - PowerPC
|
nuclear@3
|
62 // PPC64 - PowerPC64
|
nuclear@3
|
63 // MIPS - MIPS
|
nuclear@3
|
64 // OTHER - CPU for which no special support is present or needed
|
nuclear@3
|
65
|
nuclear@3
|
66
|
nuclear@3
|
67 #if defined(__x86_64__) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
|
nuclear@3
|
68 # define OVR_CPU_X86_64
|
nuclear@3
|
69 # define OVR_64BIT_POINTERS
|
nuclear@3
|
70 #elif defined(__i386__) || defined(OVR_OS_WIN32)
|
nuclear@3
|
71 # define OVR_CPU_X86
|
nuclear@3
|
72 #elif defined(__powerpc64__)
|
nuclear@3
|
73 # define OVR_CPU_PPC64
|
nuclear@3
|
74 #elif defined(__ppc__)
|
nuclear@3
|
75 # define OVR_CPU_PPC
|
nuclear@3
|
76 #elif defined(__mips__) || defined(__MIPSEL__)
|
nuclear@3
|
77 # define OVR_CPU_MIPS
|
nuclear@3
|
78 #elif defined(__arm__)
|
nuclear@3
|
79 # define OVR_CPU_ARM
|
nuclear@3
|
80 #else
|
nuclear@3
|
81 # define OVR_CPU_OTHER
|
nuclear@3
|
82 #endif
|
nuclear@3
|
83
|
nuclear@3
|
84 //-----------------------------------------------------------------------------------
|
nuclear@3
|
85 // ***** Co-Processor Architecture
|
nuclear@3
|
86 //
|
nuclear@3
|
87 // The following co-processors are defined: (OVR_CPU_x)
|
nuclear@3
|
88 //
|
nuclear@3
|
89 // SSE - Available on all modern x86 processors.
|
nuclear@3
|
90 // Altivec - Available on all modern ppc processors.
|
nuclear@3
|
91 // Neon - Available on some armv7+ processors.
|
nuclear@3
|
92
|
nuclear@3
|
93 #if defined(__SSE__) || defined(OVR_OS_WIN32)
|
nuclear@3
|
94 # define OVR_CPU_SSE
|
nuclear@3
|
95 #endif // __SSE__
|
nuclear@3
|
96
|
nuclear@3
|
97 #if defined( __ALTIVEC__ )
|
nuclear@3
|
98 # define OVR_CPU_ALTIVEC
|
nuclear@3
|
99 #endif // __ALTIVEC__
|
nuclear@3
|
100
|
nuclear@3
|
101 #if defined(__ARM_NEON__)
|
nuclear@3
|
102 # define OVR_CPU_ARM_NEON
|
nuclear@3
|
103 #endif // __ARM_NEON__
|
nuclear@3
|
104
|
nuclear@3
|
105
|
nuclear@3
|
106 //-----------------------------------------------------------------------------------
|
nuclear@3
|
107 // ***** Compiler
|
nuclear@3
|
108 //
|
nuclear@3
|
109 // The following compilers are defined: (OVR_CC_x)
|
nuclear@3
|
110 //
|
nuclear@3
|
111 // MSVC - Microsoft Visual C/C++
|
nuclear@3
|
112 // INTEL - Intel C++ for Linux / Windows
|
nuclear@3
|
113 // GNU - GNU C++
|
nuclear@3
|
114 // ARM - ARM C/C++
|
nuclear@3
|
115
|
nuclear@3
|
116 #if defined(__INTEL_COMPILER)
|
nuclear@3
|
117 // Intel 4.0 = 400
|
nuclear@3
|
118 // Intel 5.0 = 500
|
nuclear@3
|
119 // Intel 6.0 = 600
|
nuclear@3
|
120 // Intel 8.0 = 800
|
nuclear@3
|
121 // Intel 9.0 = 900
|
nuclear@3
|
122 # define OVR_CC_INTEL __INTEL_COMPILER
|
nuclear@3
|
123
|
nuclear@3
|
124 #elif defined(_MSC_VER)
|
nuclear@3
|
125 // MSVC 5.0 = 1100
|
nuclear@3
|
126 // MSVC 6.0 = 1200
|
nuclear@3
|
127 // MSVC 7.0 (VC2002) = 1300
|
nuclear@3
|
128 // MSVC 7.1 (VC2003) = 1310
|
nuclear@3
|
129 // MSVC 8.0 (VC2005) = 1400
|
nuclear@3
|
130 // MSVC 9.0 (VC2008) = 1500
|
nuclear@3
|
131 // MSVC 10.0 (VC2010) = 1600
|
nuclear@3
|
132 # define OVR_CC_MSVC _MSC_VER
|
nuclear@3
|
133
|
nuclear@3
|
134 #elif defined(__GNUC__)
|
nuclear@3
|
135 # define OVR_CC_GNU
|
nuclear@3
|
136
|
nuclear@3
|
137 #elif defined(__CC_ARM)
|
nuclear@3
|
138 # define OVR_CC_ARM
|
nuclear@3
|
139
|
nuclear@3
|
140 #else
|
nuclear@3
|
141 # error "Oculus does not support this Compiler"
|
nuclear@3
|
142 #endif
|
nuclear@3
|
143
|
nuclear@3
|
144
|
nuclear@3
|
145 //-----------------------------------------------------------------------------------
|
nuclear@3
|
146 // ***** Compiler Warnings
|
nuclear@3
|
147
|
nuclear@3
|
148 // Disable MSVC warnings
|
nuclear@3
|
149 #if defined(OVR_CC_MSVC)
|
nuclear@3
|
150 # pragma warning(disable : 4127) // Inconsistent dll linkage
|
nuclear@3
|
151 # pragma warning(disable : 4530) // Exception handling
|
nuclear@3
|
152 # if (OVR_CC_MSVC<1300)
|
nuclear@3
|
153 # pragma warning(disable : 4514) // Unreferenced inline function has been removed
|
nuclear@3
|
154 # pragma warning(disable : 4710) // Function not inlined
|
nuclear@3
|
155 # pragma warning(disable : 4714) // _force_inline not inlined
|
nuclear@3
|
156 # pragma warning(disable : 4786) // Debug variable name longer than 255 chars
|
nuclear@3
|
157 # endif // (OVR_CC_MSVC<1300)
|
nuclear@3
|
158 #endif // (OVR_CC_MSVC)
|
nuclear@3
|
159
|
nuclear@3
|
160
|
nuclear@3
|
161
|
nuclear@3
|
162 // *** Linux Unicode - must come before Standard Includes
|
nuclear@3
|
163
|
nuclear@3
|
164 #ifdef OVR_OS_LINUX
|
nuclear@3
|
165 // Use glibc unicode functions on linux.
|
nuclear@3
|
166 # ifndef _GNU_SOURCE
|
nuclear@3
|
167 # define _GNU_SOURCE
|
nuclear@3
|
168 # endif
|
nuclear@3
|
169 #endif
|
nuclear@3
|
170
|
nuclear@3
|
171 //-----------------------------------------------------------------------------------
|
nuclear@3
|
172 // ***** Standard Includes
|
nuclear@3
|
173 //
|
nuclear@3
|
174 #include <stddef.h>
|
nuclear@3
|
175 #include <limits.h>
|
nuclear@3
|
176 #include <float.h>
|
nuclear@3
|
177
|
nuclear@3
|
178
|
nuclear@3
|
179 // MSVC Based Memory Leak checking - for now
|
nuclear@3
|
180 #if defined(OVR_CC_MSVC) && defined(OVR_BUILD_DEBUG)
|
nuclear@3
|
181 # define _CRTDBG_MAP_ALLOC
|
nuclear@3
|
182 # include <stdlib.h>
|
nuclear@3
|
183 # include <crtdbg.h>
|
nuclear@3
|
184
|
nuclear@3
|
185 // Uncomment this to help debug memory leaks under Visual Studio in OVR apps only.
|
nuclear@3
|
186 // This shouldn't be defined in customer releases.
|
nuclear@3
|
187 # ifndef OVR_DEFINE_NEW
|
nuclear@3
|
188 # define OVR_DEFINE_NEW new(__FILE__, __LINE__)
|
nuclear@3
|
189 # define new OVR_DEFINE_NEW
|
nuclear@3
|
190 # endif
|
nuclear@3
|
191
|
nuclear@3
|
192 #endif
|
nuclear@3
|
193
|
nuclear@3
|
194
|
nuclear@3
|
195 //-----------------------------------------------------------------------------------
|
nuclear@3
|
196 // ***** Type definitions for Common Systems
|
nuclear@3
|
197
|
nuclear@3
|
198 namespace OVR {
|
nuclear@3
|
199
|
nuclear@3
|
200 typedef char Char;
|
nuclear@3
|
201
|
nuclear@3
|
202 // Pointer-sized integer
|
nuclear@3
|
203 typedef size_t UPInt;
|
nuclear@3
|
204 typedef ptrdiff_t SPInt;
|
nuclear@3
|
205
|
nuclear@3
|
206
|
nuclear@3
|
207 #if defined(OVR_OS_WIN32)
|
nuclear@3
|
208
|
nuclear@3
|
209 typedef char SByte; // 8 bit Integer (Byte)
|
nuclear@3
|
210 typedef unsigned char UByte;
|
nuclear@3
|
211 typedef short SInt16; // 16 bit Integer (Word)
|
nuclear@3
|
212 typedef unsigned short UInt16;
|
nuclear@3
|
213 typedef long SInt32; // 32 bit Integer
|
nuclear@3
|
214 typedef unsigned long UInt32;
|
nuclear@3
|
215 typedef __int64 SInt64; // 64 bit Integer (QWord)
|
nuclear@3
|
216 typedef unsigned __int64 UInt64;
|
nuclear@3
|
217
|
nuclear@3
|
218
|
nuclear@3
|
219 #elif defined(OVR_OS_MAC) || defined(OVR_OS_IPHONE) || defined(OVR_CC_GNU)
|
nuclear@3
|
220
|
nuclear@3
|
221 typedef int SByte __attribute__((__mode__ (__QI__)));
|
nuclear@3
|
222 typedef unsigned int UByte __attribute__((__mode__ (__QI__)));
|
nuclear@3
|
223 typedef int SInt16 __attribute__((__mode__ (__HI__)));
|
nuclear@3
|
224 typedef unsigned int UInt16 __attribute__((__mode__ (__HI__)));
|
nuclear@3
|
225 typedef int SInt32 __attribute__((__mode__ (__SI__)));
|
nuclear@3
|
226 typedef unsigned int UInt32 __attribute__((__mode__ (__SI__)));
|
nuclear@3
|
227 typedef int SInt64 __attribute__((__mode__ (__DI__)));
|
nuclear@3
|
228 typedef unsigned int UInt64 __attribute__((__mode__ (__DI__)));
|
nuclear@3
|
229
|
nuclear@3
|
230 #else
|
nuclear@3
|
231
|
nuclear@3
|
232 #include <sys/types.h>
|
nuclear@3
|
233 typedef int8_t SByte;
|
nuclear@3
|
234 typedef uint8_t UByte;
|
nuclear@3
|
235 typedef int16_t SInt16;
|
nuclear@3
|
236 typedef uint16_t UInt16;
|
nuclear@3
|
237 typedef int32_t SInt32;
|
nuclear@3
|
238 typedef uint32_t UInt32;
|
nuclear@3
|
239 typedef int64_t SInt64;
|
nuclear@3
|
240 typedef uint64_t UInt64;
|
nuclear@3
|
241
|
nuclear@3
|
242 #endif
|
nuclear@3
|
243
|
nuclear@3
|
244
|
nuclear@3
|
245 // ***** BaseTypes Namespace
|
nuclear@3
|
246
|
nuclear@3
|
247 // BaseTypes namespace is explicitly declared to allow base types to be used
|
nuclear@3
|
248 // by customers directly without other contents of OVR namespace.
|
nuclear@3
|
249 //
|
nuclear@3
|
250 // Its is expected that GFx samples will declare 'using namespace OVR::BaseTypes'
|
nuclear@3
|
251 // to allow using these directly without polluting the target scope with other
|
nuclear@3
|
252 // OVR declarations, such as Ptr<>, String or Mutex.
|
nuclear@3
|
253 namespace BaseTypes
|
nuclear@3
|
254 {
|
nuclear@3
|
255 using OVR::UPInt;
|
nuclear@3
|
256 using OVR::SPInt;
|
nuclear@3
|
257 using OVR::UByte;
|
nuclear@3
|
258 using OVR::SByte;
|
nuclear@3
|
259 using OVR::UInt16;
|
nuclear@3
|
260 using OVR::SInt16;
|
nuclear@3
|
261 using OVR::UInt32;
|
nuclear@3
|
262 using OVR::SInt32;
|
nuclear@3
|
263 using OVR::UInt64;
|
nuclear@3
|
264 using OVR::SInt64;
|
nuclear@3
|
265 } // OVR::BaseTypes
|
nuclear@3
|
266
|
nuclear@3
|
267 } // OVR
|
nuclear@3
|
268
|
nuclear@3
|
269
|
nuclear@3
|
270 //-----------------------------------------------------------------------------------
|
nuclear@3
|
271 // ***** Macro Definitions
|
nuclear@3
|
272 //
|
nuclear@3
|
273 // We define the following:
|
nuclear@3
|
274 //
|
nuclear@3
|
275 // OVR_BYTE_ORDER - Defined to either OVR_LITTLE_ENDIAN or OVR_BIG_ENDIAN
|
nuclear@3
|
276 // OVR_FORCE_INLINE - Forces inline expansion of function
|
nuclear@3
|
277 // OVR_ASM - Assembly language prefix
|
nuclear@3
|
278 // OVR_STR - Prefixes string with L"" if building unicode
|
nuclear@3
|
279 //
|
nuclear@3
|
280 // OVR_STDCALL - Use stdcall calling convention (Pascal arg order)
|
nuclear@3
|
281 // OVR_CDECL - Use cdecl calling convention (C argument order)
|
nuclear@3
|
282 // OVR_FASTCALL - Use fastcall calling convention (registers)
|
nuclear@3
|
283 //
|
nuclear@3
|
284
|
nuclear@3
|
285 // Byte order constants, OVR_BYTE_ORDER is defined to be one of these.
|
nuclear@3
|
286 #define OVR_LITTLE_ENDIAN 1
|
nuclear@3
|
287 #define OVR_BIG_ENDIAN 2
|
nuclear@3
|
288
|
nuclear@3
|
289
|
nuclear@3
|
290 // Force inline substitute - goes before function declaration
|
nuclear@3
|
291 #if defined(OVR_CC_MSVC)
|
nuclear@3
|
292 # define OVR_FORCE_INLINE __forceinline
|
nuclear@3
|
293 #elif defined(OVR_CC_GNU)
|
nuclear@3
|
294 # define OVR_FORCE_INLINE __attribute__((always_inline)) inline
|
nuclear@3
|
295 #else
|
nuclear@3
|
296 # define OVR_FORCE_INLINE inline
|
nuclear@3
|
297 #endif // OVR_CC_MSVC
|
nuclear@3
|
298
|
nuclear@3
|
299
|
nuclear@3
|
300 #if defined(OVR_OS_WIN32)
|
nuclear@3
|
301
|
nuclear@3
|
302 // ***** Win32
|
nuclear@3
|
303
|
nuclear@3
|
304 // Byte order
|
nuclear@3
|
305 #define OVR_BYTE_ORDER OVR_LITTLE_ENDIAN
|
nuclear@3
|
306
|
nuclear@3
|
307 // Calling convention - goes after function return type but before function name
|
nuclear@3
|
308 #ifdef __cplusplus_cli
|
nuclear@3
|
309 # define OVR_FASTCALL __stdcall
|
nuclear@3
|
310 #else
|
nuclear@3
|
311 # define OVR_FASTCALL __fastcall
|
nuclear@3
|
312 #endif
|
nuclear@3
|
313
|
nuclear@3
|
314 #define OVR_STDCALL __stdcall
|
nuclear@3
|
315 #define OVR_CDECL __cdecl
|
nuclear@3
|
316
|
nuclear@3
|
317
|
nuclear@3
|
318 // Assembly macros
|
nuclear@3
|
319 #if defined(OVR_CC_MSVC)
|
nuclear@3
|
320 # define OVR_ASM _asm
|
nuclear@3
|
321 #else
|
nuclear@3
|
322 # define OVR_ASM asm
|
nuclear@3
|
323 #endif // (OVR_CC_MSVC)
|
nuclear@3
|
324
|
nuclear@3
|
325 #ifdef UNICODE
|
nuclear@3
|
326 # define OVR_STR(str) L##str
|
nuclear@3
|
327 #else
|
nuclear@3
|
328 # define OVR_STR(str) str
|
nuclear@3
|
329 #endif // UNICODE
|
nuclear@3
|
330
|
nuclear@3
|
331 #else
|
nuclear@3
|
332
|
nuclear@3
|
333 // **** Standard systems
|
nuclear@3
|
334
|
nuclear@3
|
335 #if (defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN))|| \
|
nuclear@3
|
336 (defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN))
|
nuclear@3
|
337 # define OVR_BYTE_ORDER OVR_BIG_ENDIAN
|
nuclear@3
|
338 #elif (defined(__ARMEB__) || defined(OVR_CPU_PPC) || defined(OVR_CPU_PPC64))
|
nuclear@3
|
339 # define OVR_BYTE_ORDER OVR_BIG_ENDIAN
|
nuclear@3
|
340 #else
|
nuclear@3
|
341 # define OVR_BYTE_ORDER OVR_LITTLE_ENDIAN
|
nuclear@3
|
342 #endif
|
nuclear@3
|
343
|
nuclear@3
|
344 // Assembly macros
|
nuclear@3
|
345 #define OVR_ASM __asm__
|
nuclear@3
|
346 #define OVR_ASM_PROC(procname) OVR_ASM
|
nuclear@3
|
347 #define OVR_ASM_END OVR_ASM
|
nuclear@3
|
348
|
nuclear@3
|
349 // Calling convention - goes after function return type but before function name
|
nuclear@3
|
350 #define OVR_FASTCALL
|
nuclear@3
|
351 #define OVR_STDCALL
|
nuclear@3
|
352 #define OVR_CDECL
|
nuclear@3
|
353
|
nuclear@3
|
354 #endif // defined(OVR_OS_WIN32)
|
nuclear@3
|
355
|
nuclear@3
|
356
|
nuclear@3
|
357
|
nuclear@3
|
358 //-----------------------------------------------------------------------------------
|
nuclear@3
|
359 // ***** OVR_DEBUG_BREAK, OVR_ASSERT
|
nuclear@3
|
360 //
|
nuclear@3
|
361 // If not in debug build, macros do nothing
|
nuclear@3
|
362 #ifndef OVR_BUILD_DEBUG
|
nuclear@3
|
363
|
nuclear@3
|
364 # define OVR_DEBUG_BREAK ((void)0)
|
nuclear@3
|
365 # define OVR_ASSERT(p) ((void)0)
|
nuclear@3
|
366
|
nuclear@3
|
367 #else
|
nuclear@3
|
368
|
nuclear@3
|
369 // Microsoft Win32 specific debugging support
|
nuclear@3
|
370 #if defined(OVR_OS_WIN32)
|
nuclear@3
|
371 # ifdef OVR_CPU_X86
|
nuclear@3
|
372 # if defined(__cplusplus_cli)
|
nuclear@3
|
373 # define OVR_DEBUG_BREAK do { __debugbreak(); } while(0)
|
nuclear@3
|
374 # elif defined(OVR_CC_GNU)
|
nuclear@3
|
375 # define OVR_DEBUG_BREAK do { OVR_ASM("int $3\n\t"); } while(0)
|
nuclear@3
|
376 # else
|
nuclear@3
|
377 # define OVR_DEBUG_BREAK do { OVR_ASM int 3 } while (0)
|
nuclear@3
|
378 # endif
|
nuclear@3
|
379 # else
|
nuclear@3
|
380 # define OVR_DEBUG_BREAK do { __debugbreak(); } while(0)
|
nuclear@3
|
381 # endif
|
nuclear@3
|
382 // Unix specific debugging support
|
nuclear@3
|
383 #elif defined(OVR_CPU_X86) || defined(OVR_CPU_X86_64)
|
nuclear@3
|
384 # define OVR_DEBUG_BREAK do { OVR_ASM("int $3\n\t"); } while(0)
|
nuclear@3
|
385 #else
|
nuclear@3
|
386 # define OVR_DEBUG_BREAK do { *((int *) 0) = 1; } while(0)
|
nuclear@3
|
387 #endif
|
nuclear@3
|
388
|
nuclear@3
|
389 // This will cause compiler breakpoint
|
nuclear@3
|
390 #define OVR_ASSERT(p) do { if (!(p)) { OVR_DEBUG_BREAK; } } while(0)
|
nuclear@3
|
391
|
nuclear@3
|
392 #endif // OVR_BUILD_DEBUG
|
nuclear@3
|
393
|
nuclear@3
|
394
|
nuclear@3
|
395 // Compile-time assert; produces compiler error if condition is false
|
nuclear@3
|
396 #define OVR_COMPILER_ASSERT(x) { int zero = 0; switch(zero) {case 0: case x:;} }
|
nuclear@3
|
397
|
nuclear@3
|
398
|
nuclear@3
|
399
|
nuclear@3
|
400 //-----------------------------------------------------------------------------------
|
nuclear@3
|
401 // ***** OVR_UNUSED - Unused Argument handling
|
nuclear@3
|
402
|
nuclear@3
|
403 // Macro to quiet compiler warnings about unused parameters/variables.
|
nuclear@3
|
404 #if defined(OVR_CC_GNU)
|
nuclear@3
|
405 # define OVR_UNUSED(a) do {__typeof__ (&a) __attribute__ ((unused)) __tmp = &a; } while(0)
|
nuclear@3
|
406 #else
|
nuclear@3
|
407 # define OVR_UNUSED(a) (a)
|
nuclear@3
|
408 #endif
|
nuclear@3
|
409
|
nuclear@3
|
410 #define OVR_UNUSED1(a1) OVR_UNUSED(a1)
|
nuclear@3
|
411 #define OVR_UNUSED2(a1,a2) OVR_UNUSED(a1); OVR_UNUSED(a2)
|
nuclear@3
|
412 #define OVR_UNUSED3(a1,a2,a3) OVR_UNUSED2(a1,a2); OVR_UNUSED(a3)
|
nuclear@3
|
413 #define OVR_UNUSED4(a1,a2,a3,a4) OVR_UNUSED3(a1,a2,a3); OVR_UNUSED(a4)
|
nuclear@3
|
414 #define OVR_UNUSED5(a1,a2,a3,a4,a5) OVR_UNUSED4(a1,a2,a3,a4); OVR_UNUSED(a5)
|
nuclear@3
|
415 #define OVR_UNUSED6(a1,a2,a3,a4,a5,a6) OVR_UNUSED4(a1,a2,a3,a4); OVR_UNUSED2(a5,a6)
|
nuclear@3
|
416 #define OVR_UNUSED7(a1,a2,a3,a4,a5,a6,a7) OVR_UNUSED4(a1,a2,a3,a4); OVR_UNUSED3(a5,a6,a7)
|
nuclear@3
|
417 #define OVR_UNUSED8(a1,a2,a3,a4,a5,a6,a7,a8) OVR_UNUSED4(a1,a2,a3,a4); OVR_UNUSED4(a5,a6,a7,a8)
|
nuclear@3
|
418 #define OVR_UNUSED9(a1,a2,a3,a4,a5,a6,a7,a8,a9) OVR_UNUSED4(a1,a2,a3,a4); OVR_UNUSED5(a5,a6,a7,a8,a9)
|
nuclear@3
|
419
|
nuclear@3
|
420
|
nuclear@3
|
421 //-----------------------------------------------------------------------------------
|
nuclear@3
|
422 // ***** Configuration Macros
|
nuclear@3
|
423
|
nuclear@3
|
424 // SF Build type
|
nuclear@3
|
425 #ifdef OVR_BUILD_DEBUG
|
nuclear@3
|
426 # define OVR_BUILD_STRING "Debug"
|
nuclear@3
|
427 #else
|
nuclear@3
|
428 # define OVR_BUILD_STRING "Release"
|
nuclear@3
|
429 #endif
|
nuclear@3
|
430
|
nuclear@3
|
431
|
nuclear@3
|
432 //// Enables SF Debugging information
|
nuclear@3
|
433 //# define OVR_BUILD_DEBUG
|
nuclear@3
|
434
|
nuclear@3
|
435 // OVR_DEBUG_STATEMENT injects a statement only in debug builds.
|
nuclear@3
|
436 // OVR_DEBUG_SELECT injects first argument in debug builds, second argument otherwise.
|
nuclear@3
|
437 #ifdef OVR_BUILD_DEBUG
|
nuclear@3
|
438 #define OVR_DEBUG_STATEMENT(s) s
|
nuclear@3
|
439 #define OVR_DEBUG_SELECT(d, nd) d
|
nuclear@3
|
440 #else
|
nuclear@3
|
441 #define OVR_DEBUG_STATEMENT(s)
|
nuclear@3
|
442 #define OVR_DEBUG_SELECT(d, nd) nd
|
nuclear@3
|
443 #endif
|
nuclear@3
|
444
|
nuclear@3
|
445
|
nuclear@3
|
446 #define OVR_ENABLE_THREADS
|
nuclear@3
|
447 //
|
nuclear@3
|
448 // Prevents OVR from defining new within
|
nuclear@3
|
449 // type macros, so developers can override
|
nuclear@3
|
450 // new using the #define new new(...) trick
|
nuclear@3
|
451 // - used with OVR_DEFINE_NEW macro
|
nuclear@3
|
452 //# define OVR_BUILD_DEFINE_NEW
|
nuclear@3
|
453 //
|
nuclear@3
|
454
|
nuclear@3
|
455
|
nuclear@3
|
456 #endif // OVR_Types_h
|