1 /**************************************************************************
3 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
4 * Copyright 2010 LunarG, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
30 #ifndef EGLCOMPILER_INCLUDED
31 #define EGLCOMPILER_INCLUDED
34 #include "c99_compat.h" /* inline, __func__, etc. */
38 * Get standard integer types
40 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
41 (defined(_MSC_VER) && _MSC_VER >= 1600)
43 #elif defined(_MSC_VER)
44 typedef __int8
int8_t;
45 typedef unsigned __int8
uint8_t;
46 typedef __int16
int16_t;
47 typedef unsigned __int16
uint16_t;
48 typedef __int32
int32_t;
49 typedef unsigned __int32
uint32_t;
50 typedef __int64
int64_t;
51 typedef unsigned __int64
uint64_t;
54 typedef __int64
intptr_t;
55 typedef unsigned __int64
uintptr_t;
57 typedef __int32
intptr_t;
58 typedef unsigned __int32
uintptr_t;
61 # define INT64_C(__val) __val##i64
62 # define UINT64_C(__val) __val##ui64
64 /* hope the best instead of adding a bunch of ifdef's */
69 /* XXX: Use standard `inline` keyword instead */
71 # define INLINE inline
79 # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
80 # define PUBLIC __attribute__((visibility("default")))
81 # elif defined(_MSC_VER)
82 # define PUBLIC __declspec(dllexport)
88 /* XXX: Use standard `__func__` instead */
90 # define __FUNCTION__ __func__
93 #define STATIC_ASSERT(COND) \
95 (void) sizeof(char [1 - 2*!(COND)]); \
98 #endif /* EGLCOMPILER_INCLUDED */