Correct SIZE_T size according to MS SDK.
[wine] / include / basetsd.h
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_BASETSD_H
23 #define __WINE_BASETSD_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* defined(__cplusplus) */
28
29 /*
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.
33  *
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.
39  */
40
41 /* Type model indepent typedefs */
42
43 #ifndef _MSC_VER
44 #define __int8  char
45 #define __int16 short
46 #define __int32 int
47 #define __int64 long long
48 #endif /* !defined(_MSC_VER) */
49
50 typedef signed __int8    INT8, *PINT8;
51 typedef signed __int16   INT16, *PINT16;
52 typedef signed __int32   INT32, *PINT32;
53 typedef signed __int64   INT64, *PINT64;
54 typedef unsigned __int8  UINT8, *PUINT8;
55 typedef unsigned __int16 UINT16, *PUINT16;
56 typedef unsigned __int32 UINT32, *PUINT32;
57 typedef unsigned __int64 UINT64, *PUINT64;
58 typedef signed __int32   LONG32, *PLONG32;
59 typedef unsigned __int32 ULONG32, *PULONG32;
60 typedef unsigned __int32 DWORD32, *PDWORD32;
61 typedef signed __int64   LONG64, *PLONG64;
62 typedef unsigned __int64 ULONG64, *PULONG64;
63 typedef unsigned __int64 DWORD64, *PDWORD64;
64
65 /* Win32 or Win64 dependent typedef/defines. */
66
67 #ifdef _WIN64
68
69 typedef signed __int64   INT_PTR, *PINT_PTR;
70 typedef signed __int64   LONG_PTR, *PLONG_PTR;
71 typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
72 typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
73 typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
74
75 #define MAXINT_PTR 0x7fffffffffffffff
76 #define MININT_PTR 0x8000000000000000
77 #define MAXUINT_PTR 0xffffffffffffffff
78
79 typedef signed __int32   HALF_PTR, *PHALF_PTR;
80 typedef unsigned __int32 UHALF_PTR, *PUHALF_PTR;
81
82 #define MAXHALF_PTR 0x7fffffff
83 #define MINHALF_PTR 0x80000000
84 #define MAXUHALF_PTR 0xffffffff
85
86 #else /* FIXME: defined(_WIN32) */
87
88 typedef signed __int32   INT_PTR, *PINT_PTR;
89 typedef long LONG_PTR, *PLONG_PTR;
90 typedef unsigned __int32 UINT_PTR, *PUINT_PTR;
91 typedef unsigned long ULONG_PTR, *PULONG_PTR;
92 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
93
94 #define MAXINT_PTR 0x7fffffff
95 #define MININT_PTR 0x80000000
96 #define MAXUINT_PTR 0xffffffff
97
98 typedef signed __int16   HALF_PTR, *PHALF_PTR;
99 typedef unsigned __int16 UHALF_PTR, *PUHALF_PTR;
100
101 #define MAXUHALF_PTR 0xffff
102 #define MAXHALF_PTR 0x7fff
103 #define MINHALF_PTR 0x8000
104
105 #endif /* defined(_WIN64) || defined(_WIN32) */
106
107 typedef LONG_PTR SSIZE_T, *PSSIZE_T;
108 typedef ULONG_PTR SIZE_T, *PSIZE_T;
109
110 /* Some Wine-specific definitions */
111
112 /* Architecture dependent settings. */
113 /* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
114 #if defined(__i386__)
115 # undef  WORDS_BIGENDIAN
116 # undef  BITFIELDS_BIGENDIAN
117 # define ALLOW_UNALIGNED_ACCESS
118 #elif defined(__sparc__)
119 # define WORDS_BIGENDIAN
120 # define BITFIELDS_BIGENDIAN
121 # undef  ALLOW_UNALIGNED_ACCESS
122 #elif defined(__PPC__)
123 # define WORDS_BIGENDIAN
124 # define BITFIELDS_BIGENDIAN
125 # undef  ALLOW_UNALIGNED_ACCESS
126 #elif !defined(RC_INVOKED)
127 # error Unknown CPU architecture!
128 #endif
129
130 #ifdef __cplusplus
131 } /* extern "C" */
132 #endif /* defined(__cplusplus) */
133
134 #endif /* !defined(__WINE_BASETSD_H) */