win64: use new headers from mingw
[tinycc/kirr.git] / win32 / include / winapi / basetsd.h
blob47d78c4c3b12068825ce83ce369a62d8760f61f1
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _BASETSD_H_
7 #define _BASETSD_H_
9 #if (defined(__x86_64) || defined(__ia64__)) && !defined(RC_INVOKED)
10 typedef unsigned __int64 POINTER_64_INT;
11 #else
12 typedef unsigned long POINTER_64_INT;
13 #endif
15 #define POINTER_32
16 #define POINTER_64
17 #define FIRMWARE_PTR
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
23 typedef signed char INT8,*PINT8;
24 typedef signed short INT16,*PINT16;
25 typedef signed int INT32,*PINT32;
26 typedef signed __int64 INT64,*PINT64;
27 typedef unsigned char UINT8,*PUINT8;
28 typedef unsigned short UINT16,*PUINT16;
29 typedef unsigned int UINT32,*PUINT32;
30 typedef unsigned __int64 UINT64,*PUINT64;
31 typedef signed int LONG32,*PLONG32;
32 typedef unsigned int ULONG32,*PULONG32;
33 typedef unsigned int DWORD32,*PDWORD32;
35 #ifndef _W64
36 #define _W64
37 #endif
39 #ifdef _WIN64
40 typedef __int64 INT_PTR,*PINT_PTR;
41 typedef unsigned __int64 UINT_PTR,*PUINT_PTR;
42 typedef __int64 LONG_PTR,*PLONG_PTR;
43 typedef unsigned __int64 ULONG_PTR,*PULONG_PTR;
44 #define __int3264 __int64
45 #else
46 typedef int INT_PTR,*PINT_PTR;
47 typedef unsigned int UINT_PTR,*PUINT_PTR;
48 typedef long LONG_PTR,*PLONG_PTR;
49 typedef unsigned long ULONG_PTR,*PULONG_PTR;
50 #define __int3264 __int32
51 #endif
53 #ifdef _WIN64
54 #define ADDRESS_TAG_BIT 0x40000000000ULL
55 typedef __int64 SHANDLE_PTR;
56 typedef unsigned __int64 HANDLE_PTR;
57 typedef unsigned int UHALF_PTR,*PUHALF_PTR;
58 typedef int HALF_PTR,*PHALF_PTR;
60 static __inline unsigned long HandleToULong(const void *h) { return((unsigned long) (ULONG_PTR) h); }
61 static __inline long HandleToLong(const void *h) { return((long) (LONG_PTR) h); }
62 static __inline void *ULongToHandle(const unsigned long h) { return((void *) (UINT_PTR) h); }
63 static __inline void *LongToHandle(const long h) { return((void *) (INT_PTR) h); }
64 static __inline unsigned long PtrToUlong(const void *p) { return((unsigned long) (ULONG_PTR) p); }
65 static __inline unsigned int PtrToUint(const void *p) { return((unsigned int) (UINT_PTR) p); }
66 static __inline unsigned short PtrToUshort(const void *p) { return((unsigned short) (unsigned long) (ULONG_PTR) p); }
67 static __inline long PtrToLong(const void *p) { return((long) (LONG_PTR) p); }
68 static __inline int PtrToInt(const void *p) { return((int) (INT_PTR) p); }
69 static __inline short PtrToShort(const void *p) { return((short) (long) (LONG_PTR) p); }
70 static __inline void *IntToPtr(const int i) { return((void *)(INT_PTR)i); }
71 static __inline void *UIntToPtr(const unsigned int ui) { return((void *)(UINT_PTR)ui); }
72 static __inline void *LongToPtr(const long l) { return((void *)(LONG_PTR)l); }
73 static __inline void *ULongToPtr(const unsigned long ul) { return((void *)(ULONG_PTR)ul); }
75 #define PtrToPtr64(p) ((void *) p)
76 #define Ptr64ToPtr(p) ((void *) p)
77 #define HandleToHandle64(h) (PtrToPtr64(h))
78 #define Handle64ToHandle(h) (Ptr64ToPtr(h))
80 static __inline void *Ptr32ToPtr(const void *p) { return (void *)p; }
81 static __inline void *Handle32ToHandle(const void *h) { return((void *) h); }
82 static __inline void *PtrToPtr32(const void *p) { return((void *) (ULONG_PTR) p); }
84 #define HandleToHandle32(h) (PtrToPtr32(h))
85 #else
87 #define ADDRESS_TAG_BIT 0x80000000UL
89 typedef unsigned short UHALF_PTR,*PUHALF_PTR;
90 typedef short HALF_PTR,*PHALF_PTR;
91 typedef long SHANDLE_PTR;
92 typedef unsigned long HANDLE_PTR;
94 #define HandleToULong(h) ((ULONG)(ULONG_PTR)(h))
95 #define HandleToLong(h) ((LONG)(LONG_PTR) (h))
96 #define ULongToHandle(ul) ((HANDLE)(ULONG_PTR) (ul))
97 #define LongToHandle(h) ((HANDLE)(LONG_PTR) (h))
98 #define PtrToUlong(p) ((ULONG)(ULONG_PTR) (p))
99 #define PtrToLong(p) ((LONG)(LONG_PTR) (p))
100 #define PtrToUint(p) ((UINT)(UINT_PTR) (p))
101 #define PtrToInt(p) ((INT)(INT_PTR) (p))
102 #define PtrToUshort(p) ((unsigned short)(ULONG_PTR)(p))
103 #define PtrToShort(p) ((short)(LONG_PTR)(p))
104 #define IntToPtr(i) ((VOID *)(INT_PTR)((int)i))
105 #define UIntToPtr(ui) ((VOID *)(UINT_PTR)((unsigned int)ui))
106 #define LongToPtr(l) ((VOID *)(LONG_PTR)((long)l))
107 #define ULongToPtr(ul) ((VOID *)(ULONG_PTR)((unsigned long)ul))
109 static __inline void *PtrToPtr64(const void *p) { return((void *) (ULONG_PTR)p); }
110 static __inline void *Ptr64ToPtr(const void *p) { return((void *) (ULONG_PTR) p); }
111 static __inline void *HandleToHandle64(const void *h) { return((void *) h); }
112 static __inline void *Handle64ToHandle(const void *h) { return((void *) (ULONG_PTR) h); }
114 #define Ptr32ToPtr(p) ((void *) p)
115 #define Handle32ToHandle(h) (Ptr32ToPtr(h))
116 #define PtrToPtr32(p) ((void *) p)
117 #define HandleToHandle32(h) (PtrToPtr32(h))
118 #endif
120 #define HandleToUlong(h) HandleToULong(h)
121 #define UlongToHandle(ul) ULongToHandle(ul)
122 #define UlongToPtr(ul) ULongToPtr(ul)
123 #define UintToPtr(ui) UIntToPtr(ui)
125 #define MAXUINT_PTR (~((UINT_PTR)0))
126 #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
127 #define MININT_PTR (~MAXINT_PTR)
129 #define MAXULONG_PTR (~((ULONG_PTR)0))
130 #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
131 #define MINLONG_PTR (~MAXLONG_PTR)
133 #define MAXUHALF_PTR ((UHALF_PTR)~0)
134 #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
135 #define MINHALF_PTR (~MAXHALF_PTR)
137 typedef ULONG_PTR SIZE_T,*PSIZE_T;
138 typedef LONG_PTR SSIZE_T,*PSSIZE_T;
139 typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR;
140 typedef __int64 LONG64,*PLONG64;
141 typedef unsigned __int64 ULONG64,*PULONG64;
142 typedef unsigned __int64 DWORD64,*PDWORD64;
143 typedef ULONG_PTR KAFFINITY;
144 typedef KAFFINITY *PKAFFINITY;
146 #ifdef __cplusplus
148 #endif
149 #endif