VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/basetsd.h

最後變更 在這個檔案是 53206,由 vboxsync 提交於 10 年 前

Devices/vmsvga: header fixes

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 9.6 KB
 
1/*
2 * Compilers that uses ILP32, LP64 or P64 type models
3 * for both Win32 and Win64 are supported by this file.
4 *
5 * Copyright (C) 1999 Patrik Stridvall
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22/*
23 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
24 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
25 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
26 * a choice of LGPL license versions is made available with the language indicating
27 * that LGPLv2 or any later version may be used, or where a choice of which version
28 * of the LGPL is applied is otherwise unspecified.
29 */
30
31#ifndef __WINE_BASETSD_H
32#define __WINE_BASETSD_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* defined(__cplusplus) */
37
38/*
39 * Win32 was easy to implement under Unix since most 32-bit Unices use the same
40 * type model (ILP32) as Win32, where int, long and pointer are 32-bit.
41 *
42 * Win64, however, can cause some problems. Most 64-bit Unices use the LP64 type
43 * model where int is 32-bit and long and pointer are 64-bit. Win64 on the other
44 * hand uses the LLP64 type model where int and long are 32 bit and pointer is
45 * 64-bit.
46 */
47
48#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__aarch64__)) && !defined(_WIN64)
49#define _WIN64
50#endif
51
52/* Type model independent typedefs */
53/* The __intXX types are native types defined by the MS C compiler.
54 * Apps that make use of them before they get defined here, can
55 * simply add to the command line:
56 * -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
57 */
58#if !defined(_MSC_VER) && !defined(__WIDL__)
59# ifndef __int8
60# define __int8 char
61# endif
62# ifndef __int16
63# define __int16 short
64# endif
65# ifndef __int32
66# define __int32 int
67# endif
68# ifndef __int64
69# if defined(_WIN64) && !defined(__MINGW64__)
70# define __int64 long
71# else
72# define __int64 long long
73# endif
74# endif
75#endif /* !defined(_MSC_VER) */
76
77/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
78#ifndef DECLSPEC_ALIGN
79# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
80# define DECLSPEC_ALIGN(x) __declspec(align(x))
81# elif defined(__GNUC__)
82# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
83# else
84# define DECLSPEC_ALIGN(x)
85# endif
86#endif
87
88typedef signed char INT8, *PINT8;
89typedef signed short INT16, *PINT16;
90typedef signed int INT32, *PINT32;
91typedef unsigned char UINT8, *PUINT8;
92typedef unsigned short UINT16, *PUINT16;
93typedef unsigned int UINT32, *PUINT32;
94typedef signed int LONG32, *PLONG32;
95typedef unsigned int ULONG32, *PULONG32;
96typedef unsigned int DWORD32, *PDWORD32;
97
98#ifdef _MSC_VER
99typedef signed __int64 INT64, *PINT64;
100typedef unsigned __int64 UINT64, *PUINT64;
101typedef signed __int64 LONG64, *PLONG64;
102typedef unsigned __int64 ULONG64, *PULONG64;
103typedef unsigned __int64 DWORD64, *PDWORD64;
104#else
105typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
106typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
107typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
108typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
109typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
110#endif
111
112/* Basic pointer-sized integer types */
113
114#if defined(__midl) || defined(__WIDL__)
115
116typedef /* [public] */ signed __int3264 INT_PTR, *PINT_PTR;
117typedef /* [public] */ signed __int3264 LONG_PTR, *PLONG_PTR;
118typedef /* [public] */ unsigned __int3264 UINT_PTR, *PUINT_PTR;
119typedef /* [public] */ unsigned __int3264 ULONG_PTR, *PULONG_PTR;
120typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
121
122#elif defined(_WIN64)
123
124#define __int3264 __int64
125
126typedef signed __int64 INT_PTR, *PINT_PTR;
127typedef signed __int64 LONG_PTR, *PLONG_PTR;
128typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
129typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
130typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
131
132#else
133
134#define __int3264 __int32
135
136typedef long INT_PTR, *PINT_PTR;
137typedef unsigned long UINT_PTR, *PUINT_PTR;
138typedef long LONG_PTR, *PLONG_PTR;
139typedef unsigned long ULONG_PTR, *PULONG_PTR;
140typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
141
142#endif
143
144/* Win32 or Win64 dependent typedef/defines. */
145
146#ifdef _WIN64
147
148#define MAXINT_PTR 0x7fffffffffffffff
149#define MININT_PTR 0x8000000000000000
150#define MAXUINT_PTR 0xffffffffffffffff
151
152typedef __int64 SHANDLE_PTR;
153typedef unsigned __int64 HANDLE_PTR;
154typedef int HALF_PTR, *PHALF_PTR;
155typedef unsigned int UHALF_PTR, *PUHALF_PTR;
156
157#define MAXHALF_PTR 0x7fffffff
158#define MINHALF_PTR 0x80000000
159#define MAXUHALF_PTR 0xffffffff
160
161#if !defined(__midl) && !defined(__WIDL__)
162
163static inline ULONG32 HandleToULong(const void *h)
164{
165 return (ULONG32)(ULONG_PTR)h;
166}
167
168static inline LONG32 HandleToLong(const void *h)
169{
170 return (LONG32)(LONG_PTR)h;
171}
172
173static inline void *ULongToHandle(ULONG32 ul)
174{
175 return (void *)(ULONG_PTR)ul;
176}
177
178static inline void *LongToHandle(LONG32 l)
179{
180 return (void *)(LONG_PTR)l;
181}
182
183static inline ULONG32 PtrToUlong(const void *p)
184{
185 return (ULONG32)(ULONG_PTR)p;
186}
187
188static inline LONG32 PtrToLong(const void *p)
189{
190 return (LONG32)(LONG_PTR)p;
191}
192
193static inline UINT32 PtrToUint(const void *p)
194{
195 return (UINT32)(UINT_PTR)p;
196}
197
198static inline INT32 PtrToInt(const void *p)
199{
200 return (INT32)(INT_PTR)p;
201}
202
203static inline UINT16 PtrToUshort(const void *p)
204{
205 return (UINT16)(ULONG_PTR)p;
206}
207
208static inline INT16 PtrToShort(const void *p)
209{
210 return (INT16)(LONG_PTR)p;
211}
212
213static inline void *IntToPtr(INT32 i)
214{
215 return (void *)(INT_PTR)i;
216}
217
218static inline void *UIntToPtr(UINT32 ui)
219{
220 return (void *)(UINT_PTR)ui;
221}
222
223static inline void *LongToPtr(LONG32 l)
224{
225 return (void *)(LONG_PTR)l;
226}
227
228static inline void *ULongToPtr(ULONG32 ul)
229{
230 return (void *)(ULONG_PTR)ul;
231}
232
233#endif /* !__midl && !__WIDL__ */
234
235#else /* FIXME: defined(_WIN32) */
236
237#define MAXINT_PTR 0x7fffffff
238#define MININT_PTR 0x80000000
239#define MAXUINT_PTR 0xffffffff
240
241typedef long SHANDLE_PTR;
242typedef unsigned long HANDLE_PTR;
243typedef signed short HALF_PTR, *PHALF_PTR;
244typedef unsigned short UHALF_PTR, *PUHALF_PTR;
245
246#define MAXUHALF_PTR 0xffff
247#define MAXHALF_PTR 0x7fff
248#define MINHALF_PTR 0x8000
249
250#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h))
251#define HandleToLong(h) ((LONG)(LONG_PTR)(h))
252#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR)(ul))
253#define LongToHandle(l) ((HANDLE)(LONG_PTR)(l))
254#define PtrToUlong(p) ((ULONG)(ULONG_PTR)(p))
255#define PtrToLong(p) ((LONG)(LONG_PTR)(p))
256#define PtrToUint(p) ((UINT)(UINT_PTR)(p))
257#define PtrToInt(p) ((INT)(INT_PTR)(p))
258#define PtrToUshort(p) ((USHORT)(ULONG_PTR)(p))
259#define PtrToShort(p) ((SHORT)(LONG_PTR)(p))
260#define IntToPtr(i) ((void *)(INT_PTR)((INT)i))
261#define UIntToPtr(ui) ((void *)(UINT_PTR)((UINT)ui))
262#define LongToPtr(l) ((void *)(LONG_PTR)((LONG)l))
263#define ULongToPtr(ul) ((void *)(ULONG_PTR)((ULONG)ul))
264
265#endif /* defined(_WIN64) || defined(_WIN32) */
266
267#define HandleToUlong(h) HandleToULong(h)
268#define UlongToHandle(ul) ULongToHandle(ul)
269#define UintToPtr(ui) UIntToPtr(ui)
270#define UlongToPtr(ul) ULongToPtr(ul)
271
272typedef LONG_PTR SSIZE_T, *PSSIZE_T;
273typedef ULONG_PTR SIZE_T, *PSIZE_T;
274
275typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
276
277/* Some Wine-specific definitions */
278
279/* Architecture dependent settings. */
280/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
281#if defined(__i386__)
282# undef WORDS_BIGENDIAN
283# undef BITFIELDS_BIGENDIAN
284# define ALLOW_UNALIGNED_ACCESS
285#elif defined(__x86_64__)
286# undef WORDS_BIGENDIAN
287# undef BITFIELDS_BIGENDIAN
288# define ALLOW_UNALIGNED_ACCESS
289#elif defined(__sparc__)
290# define WORDS_BIGENDIAN
291# define BITFIELDS_BIGENDIAN
292# undef ALLOW_UNALIGNED_ACCESS
293#elif defined(__powerpc__)
294# define WORDS_BIGENDIAN
295# define BITFIELDS_BIGENDIAN
296# undef ALLOW_UNALIGNED_ACCESS
297#elif defined(__ALPHA__)
298# undef WORDS_BIGENDIAN
299# undef BITFIELDS_BIGENDIAN
300# undef ALLOW_UNALIGNED_ACCESS
301#elif defined(__ARMEB__)
302# define WORDS_BIGENDIAN
303# define BITFIELDS_BIGENDIAN
304# undef ALLOW_UNALIGNED_ACCESS
305#elif defined(__ARMEL__) || defined(__arm__)
306# undef WORDS_BIGENDIAN
307# undef BITFIELDS_BIGENDIAN
308# undef ALLOW_UNALIGNED_ACCESS
309#elif defined(__AARCH64EB__)
310# define WORDS_BIGENDIAN
311# define BITFIELDS_BIGENDIAN
312# undef ALLOW_UNALIGNED_ACCESS
313#elif defined(__AARCH64EL__) || defined(__aarch64__)
314# undef WORDS_BIGENDIAN
315# undef BITFIELDS_BIGENDIAN
316# undef ALLOW_UNALIGNED_ACCESS
317#elif defined(__MIPSEB__)
318# define WORDS_BIGENDIAN
319# define BITFIELDS_BIGENDIAN
320# undef ALLOW_UNALIGNED_ACCESS
321#elif defined(__MIPSEL__)
322# undef WORDS_BIGENDIAN
323# undef BITFIELDS_BIGENDIAN
324# undef ALLOW_UNALIGNED_ACCESS
325#elif !defined(RC_INVOKED) && !defined(__WIDL__) && !defined(__midl)
326# error Unknown CPU architecture!
327#endif
328
329#ifdef __cplusplus
330} /* extern "C" */
331#endif /* defined(__cplusplus) */
332
333#endif /* !defined(__WINE_BASETSD_H) */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette