2 * Compilers that uses ILP32, LP64 or P64 type models
3 * for both Win32 and Win64 are supported by this file.
5 * Copyright (C) 1999 Patrik Stridvall
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __WINE_BASETSD_H
23 #define __WINE_BASETSD_H
27 #endif /* defined(__cplusplus) */
30 * Win32 was easy to implement under Unix since most (all?) 32-bit
31 * Unices uses the same type model (ILP32) as Win32, where int, long
32 * and pointer are 32-bit.
34 * Win64, however, will cause some problems when implemented under Unix.
35 * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
36 * the LP64 type model where int is 32-bit and long and pointer are
37 * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
38 * type model where int and long are 32 bit and pointer is 64-bit.
41 /* Type model independent typedefs */
42 /* The __intXX types are native types defined by the MS C compiler.
43 * Apps that make use of them before they get defined here, can
44 * simply add to the command line:
45 * -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
47 #if !defined(_MSC_VER) && !defined(__WIDL__)
52 # define __int16 short
58 # define __int64 long long
60 #endif /* !defined(_MSC_VER) */
62 /* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
63 #ifndef DECLSPEC_ALIGN
64 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
65 # define DECLSPEC_ALIGN(x) __declspec(align(x))
66 # elif defined(__GNUC__)
67 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
69 # define DECLSPEC_ALIGN(x)
73 typedef signed char INT8, *PINT8;
74 typedef signed short INT16, *PINT16;
75 typedef signed int INT32, *PINT32;
76 typedef unsigned char UINT8, *PUINT8;
77 typedef unsigned short UINT16, *PUINT16;
78 typedef unsigned int UINT32, *PUINT32;
79 typedef signed int LONG32, *PLONG32;
80 typedef unsigned int ULONG32, *PULONG32;
81 typedef unsigned int DWORD32, *PDWORD32;
84 typedef signed __int64 INT64, *PINT64;
85 typedef unsigned __int64 UINT64, *PUINT64;
86 typedef signed __int64 LONG64, *PLONG64;
87 typedef unsigned __int64 ULONG64, *PULONG64;
88 typedef unsigned __int64 DWORD64, *PDWORD64;
90 typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
91 typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
92 typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
93 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
94 typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
97 /* Win32 or Win64 dependent typedef/defines. */
101 typedef signed __int64 INT_PTR, *PINT_PTR;
102 typedef signed __int64 LONG_PTR, *PLONG_PTR;
103 typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
104 typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
105 typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
107 #define MAXINT_PTR 0x7fffffffffffffff
108 #define MININT_PTR 0x8000000000000000
109 #define MAXUINT_PTR 0xffffffffffffffff
111 typedef int HALF_PTR, *PHALF_PTR;
112 typedef unsigned int UHALF_PTR, *PUHALF_PTR;
114 #define MAXHALF_PTR 0x7fffffff
115 #define MINHALF_PTR 0x80000000
116 #define MAXUHALF_PTR 0xffffffff
118 #else /* FIXME: defined(_WIN32) */
120 typedef int INT_PTR, *PINT_PTR;
121 typedef long LONG_PTR, *PLONG_PTR;
122 typedef unsigned int UINT_PTR, *PUINT_PTR;
123 typedef unsigned long ULONG_PTR, *PULONG_PTR;
124 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
126 #define MAXINT_PTR 0x7fffffff
127 #define MININT_PTR 0x80000000
128 #define MAXUINT_PTR 0xffffffff
130 typedef signed short HALF_PTR, *PHALF_PTR;
131 typedef unsigned short UHALF_PTR, *PUHALF_PTR;
133 #define MAXUHALF_PTR 0xffff
134 #define MAXHALF_PTR 0x7fff
135 #define MINHALF_PTR 0x8000
137 #endif /* defined(_WIN64) || defined(_WIN32) */
139 typedef LONG_PTR SSIZE_T, *PSSIZE_T;
140 typedef ULONG_PTR SIZE_T, *PSIZE_T;
142 typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
144 /* Some Wine-specific definitions */
146 /* Architecture dependent settings. */
147 /* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
148 #if defined(__i386__)
149 # undef WORDS_BIGENDIAN
150 # undef BITFIELDS_BIGENDIAN
151 # define ALLOW_UNALIGNED_ACCESS
152 #elif defined(__x86_64__)
153 # undef WORDS_BIGENDIAN
154 # undef BITFIELDS_BIGENDIAN
155 # define ALLOW_UNALIGNED_ACCESS
156 #elif defined(__sparc__)
157 # define WORDS_BIGENDIAN
158 # define BITFIELDS_BIGENDIAN
159 # undef ALLOW_UNALIGNED_ACCESS
160 #elif defined(__powerpc__)
161 # define WORDS_BIGENDIAN
162 # define BITFIELDS_BIGENDIAN
163 # undef ALLOW_UNALIGNED_ACCESS
164 #elif defined(__ALPHA__)
165 # undef WORDS_BIGENDIAN
166 # undef BITFIELDS_BIGENDIAN
167 # undef ALLOW_UNALIGNED_ACCESS
168 #elif !defined(RC_INVOKED) && !defined(__WIDL__)
169 # error Unknown CPU architecture!
174 #endif /* defined(__cplusplus) */
176 #endif /* !defined(__WINE_BASETSD_H) */