Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Compilers that uses ILP32, LP64 or P64 type models |
| 3 | * for both Win32 and Win64 are supported by this file. |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 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 |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #ifndef __WINE_BASETSD_H |
| 23 | #define __WINE_BASETSD_H |
| 24 | |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 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 */ |
Dimitrie O. Paun | fb82973 | 2002-11-23 01:03:40 +0000 | [diff] [blame] | 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" |
| 46 | */ |
Patrik Stridvall | 395e8ba | 2002-02-05 18:09:29 +0000 | [diff] [blame] | 47 | #ifndef _MSC_VER |
Dimitrie O. Paun | fb82973 | 2002-11-23 01:03:40 +0000 | [diff] [blame] | 48 | # 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 Stridvall | 395e8ba | 2002-02-05 18:09:29 +0000 | [diff] [blame] | 60 | #endif /* !defined(_MSC_VER) */ |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 61 | |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 62 | typedef signed __int8 INT8, *PINT8; |
| 63 | typedef signed __int16 INT16, *PINT16; |
| 64 | typedef signed __int32 INT32, *PINT32; |
| 65 | typedef signed __int64 INT64, *PINT64; |
| 66 | typedef unsigned __int8 UINT8, *PUINT8; |
| 67 | typedef unsigned __int16 UINT16, *PUINT16; |
| 68 | typedef unsigned __int32 UINT32, *PUINT32; |
| 69 | typedef unsigned __int64 UINT64, *PUINT64; |
| 70 | typedef signed __int32 LONG32, *PLONG32; |
| 71 | typedef unsigned __int32 ULONG32, *PULONG32; |
| 72 | typedef unsigned __int32 DWORD32, *PDWORD32; |
| 73 | typedef signed __int64 LONG64, *PLONG64; |
| 74 | typedef unsigned __int64 ULONG64, *PULONG64; |
| 75 | typedef unsigned __int64 DWORD64, *PDWORD64; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 76 | |
| 77 | /* Win32 or Win64 dependent typedef/defines. */ |
| 78 | |
| 79 | #ifdef _WIN64 |
| 80 | |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 81 | typedef signed __int64 INT_PTR, *PINT_PTR; |
| 82 | typedef signed __int64 LONG_PTR, *PLONG_PTR; |
| 83 | typedef unsigned __int64 UINT_PTR, *PUINT_PTR; |
| 84 | typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; |
| 85 | typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 86 | |
| 87 | #define MAXINT_PTR 0x7fffffffffffffff |
| 88 | #define MININT_PTR 0x8000000000000000 |
| 89 | #define MAXUINT_PTR 0xffffffffffffffff |
| 90 | |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 91 | typedef signed __int32 HALF_PTR, *PHALF_PTR; |
| 92 | typedef unsigned __int32 UHALF_PTR, *PUHALF_PTR; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 93 | |
| 94 | #define MAXHALF_PTR 0x7fffffff |
| 95 | #define MINHALF_PTR 0x80000000 |
| 96 | #define MAXUHALF_PTR 0xffffffff |
| 97 | |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 98 | #else /* FIXME: defined(_WIN32) */ |
| 99 | |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 100 | typedef signed __int32 INT_PTR, *PINT_PTR; |
Dmitry Timoshkov | 472d016 | 2002-09-21 01:21:00 +0000 | [diff] [blame] | 101 | typedef long LONG_PTR, *PLONG_PTR; |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 102 | typedef unsigned __int32 UINT_PTR, *PUINT_PTR; |
Dmitry Timoshkov | 472d016 | 2002-09-21 01:21:00 +0000 | [diff] [blame] | 103 | typedef unsigned long ULONG_PTR, *PULONG_PTR; |
| 104 | typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 105 | |
| 106 | #define MAXINT_PTR 0x7fffffff |
| 107 | #define MININT_PTR 0x80000000 |
| 108 | #define MAXUINT_PTR 0xffffffff |
| 109 | |
Alexandre Julliard | dd0bdbe | 2002-09-12 17:29:12 +0000 | [diff] [blame] | 110 | typedef signed __int16 HALF_PTR, *PHALF_PTR; |
| 111 | typedef unsigned __int16 UHALF_PTR, *PUHALF_PTR; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 112 | |
| 113 | #define MAXUHALF_PTR 0xffff |
| 114 | #define MAXHALF_PTR 0x7fff |
| 115 | #define MINHALF_PTR 0x8000 |
| 116 | |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 117 | #endif /* defined(_WIN64) || defined(_WIN32) */ |
| 118 | |
Dmitry Timoshkov | 472d016 | 2002-09-21 01:21:00 +0000 | [diff] [blame] | 119 | typedef LONG_PTR SSIZE_T, *PSSIZE_T; |
| 120 | typedef ULONG_PTR SIZE_T, *PSIZE_T; |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 121 | |
Alexandre Julliard | 9f0ff1b | 2002-05-29 02:02:19 +0000 | [diff] [blame] | 122 | /* 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 Edwards | 31e4629 | 2002-12-10 19:04:45 +0000 | [diff] [blame^] | 138 | #elif defined(__ALPHA__) |
| 139 | # define WORDS_LITTLEENDIAN |
| 140 | # define BITFIELDS_LITTLEENDIAN |
| 141 | # undef ALLOW_UNALIGNED_ACCESS |
Alexandre Julliard | 9f0ff1b | 2002-05-29 02:02:19 +0000 | [diff] [blame] | 142 | #elif !defined(RC_INVOKED) |
| 143 | # error Unknown CPU architecture! |
| 144 | #endif |
| 145 | |
Patrik Stridvall | 2d0bb2a | 1999-07-04 15:56:03 +0000 | [diff] [blame] | 146 | #ifdef __cplusplus |
| 147 | } /* extern "C" */ |
| 148 | #endif /* defined(__cplusplus) */ |
| 149 | |
| 150 | #endif /* !defined(__WINE_BASETSD_H) */ |