blob: 9b71d4045348a658e4eeb28443db35b95ed50c2e [file] [log] [blame]
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +00001/*
2 * Compilers that uses ILP32, LP64 or P64 type models
3 * for both Win32 and Win64 are supported by this file.
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00004 *
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
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000020 */
21
22#ifndef __WINE_BASETSD_H
23#define __WINE_BASETSD_H
24
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000025#ifdef __cplusplus
26extern "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 */
Dimitrie O. Paunfb829732002-11-23 01:03:40 +000042/* 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"
46 */
Patrik Stridvall395e8ba2002-02-05 18:09:29 +000047#ifndef _MSC_VER
Dimitrie O. Paunfb829732002-11-23 01:03:40 +000048# ifndef __int8
49# define __int8 char
50# endif
51# ifndef __int16
52# define __int16 short
53# endif
54# ifndef __int32
55# define __int32 int
56# endif
57# ifndef __int64
58# define __int64 long long
59# endif
Patrik Stridvall395e8ba2002-02-05 18:09:29 +000060#endif /* !defined(_MSC_VER) */
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000061
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +000062typedef signed __int8 INT8, *PINT8;
63typedef signed __int16 INT16, *PINT16;
64typedef signed __int32 INT32, *PINT32;
65typedef signed __int64 INT64, *PINT64;
66typedef unsigned __int8 UINT8, *PUINT8;
67typedef unsigned __int16 UINT16, *PUINT16;
68typedef unsigned __int32 UINT32, *PUINT32;
69typedef unsigned __int64 UINT64, *PUINT64;
70typedef signed __int32 LONG32, *PLONG32;
71typedef unsigned __int32 ULONG32, *PULONG32;
72typedef unsigned __int32 DWORD32, *PDWORD32;
73typedef signed __int64 LONG64, *PLONG64;
74typedef unsigned __int64 ULONG64, *PULONG64;
75typedef unsigned __int64 DWORD64, *PDWORD64;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000076
77/* Win32 or Win64 dependent typedef/defines. */
78
79#ifdef _WIN64
80
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +000081typedef signed __int64 INT_PTR, *PINT_PTR;
82typedef signed __int64 LONG_PTR, *PLONG_PTR;
83typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
84typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
85typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000086
87#define MAXINT_PTR 0x7fffffffffffffff
88#define MININT_PTR 0x8000000000000000
89#define MAXUINT_PTR 0xffffffffffffffff
90
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +000091typedef signed __int32 HALF_PTR, *PHALF_PTR;
92typedef unsigned __int32 UHALF_PTR, *PUHALF_PTR;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000093
94#define MAXHALF_PTR 0x7fffffff
95#define MINHALF_PTR 0x80000000
96#define MAXUHALF_PTR 0xffffffff
97
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +000098#else /* FIXME: defined(_WIN32) */
99
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +0000100typedef signed __int32 INT_PTR, *PINT_PTR;
Dmitry Timoshkov472d0162002-09-21 01:21:00 +0000101typedef long LONG_PTR, *PLONG_PTR;
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +0000102typedef unsigned __int32 UINT_PTR, *PUINT_PTR;
Dmitry Timoshkov472d0162002-09-21 01:21:00 +0000103typedef unsigned long ULONG_PTR, *PULONG_PTR;
104typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +0000105
106#define MAXINT_PTR 0x7fffffff
107#define MININT_PTR 0x80000000
108#define MAXUINT_PTR 0xffffffff
109
Alexandre Julliarddd0bdbe2002-09-12 17:29:12 +0000110typedef signed __int16 HALF_PTR, *PHALF_PTR;
111typedef unsigned __int16 UHALF_PTR, *PUHALF_PTR;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +0000112
113#define MAXUHALF_PTR 0xffff
114#define MAXHALF_PTR 0x7fff
115#define MINHALF_PTR 0x8000
116
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +0000117#endif /* defined(_WIN64) || defined(_WIN32) */
118
Dmitry Timoshkov472d0162002-09-21 01:21:00 +0000119typedef LONG_PTR SSIZE_T, *PSSIZE_T;
120typedef ULONG_PTR SIZE_T, *PSIZE_T;
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +0000121
Alexandre Julliard9f0ff1b2002-05-29 02:02:19 +0000122/* Some Wine-specific definitions */
123
124/* Architecture dependent settings. */
125/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
126#if defined(__i386__)
127# undef WORDS_BIGENDIAN
128# undef BITFIELDS_BIGENDIAN
129# define ALLOW_UNALIGNED_ACCESS
130#elif defined(__sparc__)
131# define WORDS_BIGENDIAN
132# define BITFIELDS_BIGENDIAN
133# undef ALLOW_UNALIGNED_ACCESS
134#elif defined(__PPC__)
135# define WORDS_BIGENDIAN
136# define BITFIELDS_BIGENDIAN
137# undef ALLOW_UNALIGNED_ACCESS
Steven Edwards31e46292002-12-10 19:04:45 +0000138#elif defined(__ALPHA__)
139# define WORDS_LITTLEENDIAN
140# define BITFIELDS_LITTLEENDIAN
141# undef ALLOW_UNALIGNED_ACCESS
Alexandre Julliard9f0ff1b2002-05-29 02:02:19 +0000142#elif !defined(RC_INVOKED)
143# error Unknown CPU architecture!
144#endif
145
Patrik Stridvall2d0bb2a1999-07-04 15:56:03 +0000146#ifdef __cplusplus
147} /* extern "C" */
148#endif /* defined(__cplusplus) */
149
150#endif /* !defined(__WINE_BASETSD_H) */