1 /**************************************************************************
3 * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
38 #include "xf86_ansic.h"
39 #include "xf86_libc.h"
43 #if defined(_WIN32) && !defined(__WIN32__)
49 /* Avoid 'expression is always true' warning */
50 #pragma warning(disable: 4296)
57 typedef __int8
int8_t;
58 typedef unsigned __int8
uint8_t;
59 typedef __int16
int16_t;
60 typedef unsigned __int16
uint16_t;
61 #ifndef __eglplatform_h_
62 typedef __int32
int32_t;
64 typedef unsigned __int32
uint32_t;
65 typedef __int64
int64_t;
66 typedef unsigned __int64
uint64_t;
69 typedef __int64
intptr_t;
70 typedef unsigned __int64
uintptr_t;
72 typedef __int32
intptr_t;
73 typedef unsigned __int32
uintptr_t;
76 #define INT64_C(__val) __val##i64
77 #define UINT64_C(__val) __val##ui64
84 #define __bool_true_false_are_defined 1
85 #endif /* !__cplusplus */
88 #ifndef __STDC_LIMIT_MACROS
89 #define __STDC_LIMIT_MACROS 1
97 typedef unsigned int uint
;
98 typedef unsigned short ushort
;
100 typedef unsigned char ubyte
;
105 typedef unsigned char boolean
;
115 /* Function inlining */
118 # define INLINE inline
119 # elif defined(__GNUC__)
120 # define INLINE __inline__
121 # elif defined(_MSC_VER)
122 # define INLINE __inline
123 # elif defined(__ICL)
124 # define INLINE __inline
125 # elif defined(__INTEL_COMPILER)
126 # define INLINE inline
127 # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
128 # define INLINE __inline
129 # elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
130 # define INLINE inline
131 # elif (__STDC_VERSION__ >= 199901L) /* C99 */
132 # define INLINE inline
138 /* The __FUNCTION__ gcc variable is generally only used for debugging.
139 * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
142 # if (!defined(__GNUC__) || (__GNUC__ < 2))
143 # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
144 (defined(__SUNPRO_C) && defined(__C99FEATURES__))
145 # define __FUNCTION__ __func__
147 # define __FUNCTION__ "<unknown>"
154 /* This should match linux gcc cdecl semantics everywhere, so that we
155 * just codegen one calling convention on all platforms.
158 #define PIPE_CDECL __cdecl
165 #if defined(__GNUC__)
166 #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___aligned[SIZE] __attribute__(( aligned( 16 ) ))
167 #define ALIGN16_ASSIGN(NAME) NAME##___aligned
168 #define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) ))
169 #define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) ))
170 #if __GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)
171 #define ALIGN_STACK __attribute__((force_align_arg_pointer))
176 #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1]
177 #define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned)
178 #define ALIGN16_ATTRIB
179 #define ALIGN8_ATTRIB
185 #endif /* P_COMPILER_H */