1 | #ifndef _BASETSD_H
|
---|
2 | #define _BASETSD_H
|
---|
3 | #if __GNUC__ >=3
|
---|
4 | #pragma GCC system_header
|
---|
5 | #endif
|
---|
6 |
|
---|
7 | #ifdef __GNUC__
|
---|
8 | #ifndef __int64
|
---|
9 | #define __int64 long long
|
---|
10 | #endif
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #if defined(_WIN64)
|
---|
14 | #define __int3264 __int64
|
---|
15 | #define ADDRESS_TAG_BIT 0x40000000000UI64
|
---|
16 | #else /* !_WIN64 */
|
---|
17 | #define __int3264 __int32
|
---|
18 | #define ADDRESS_TAG_BIT 0x80000000UL
|
---|
19 | #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) )
|
---|
20 | #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
|
---|
21 | #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h))
|
---|
22 | #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
|
---|
23 | #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
|
---|
24 | #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
|
---|
25 | #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
|
---|
26 | #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
|
---|
27 | #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
|
---|
28 | #define IntToPtr( i ) ((VOID*)(INT_PTR)((int)i))
|
---|
29 | #define UIntToPtr( ui ) ((VOID*)(UINT_PTR)((unsigned int)ui))
|
---|
30 | #define LongToPtr( l ) ((VOID*)(LONG_PTR)((long)l))
|
---|
31 | #define ULongToPtr( ul ) ((VOID*)(ULONG_PTR)((unsigned long)ul))
|
---|
32 | #endif /* !_WIN64 */
|
---|
33 |
|
---|
34 | #define UlongToPtr(ul) ULongToPtr(ul)
|
---|
35 | #define UintToPtr(ui) UIntToPtr(ui)
|
---|
36 | #define MAXUINT_PTR (~((UINT_PTR)0))
|
---|
37 | #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
|
---|
38 | #define MININT_PTR (~MAXINT_PTR)
|
---|
39 | #define MAXULONG_PTR (~((ULONG_PTR)0))
|
---|
40 | #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
|
---|
41 | #define MINLONG_PTR (~MAXLONG_PTR)
|
---|
42 | #define MAXUHALF_PTR ((UHALF_PTR)~0)
|
---|
43 | #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
|
---|
44 | #define MINHALF_PTR (~MAXHALF_PTR)
|
---|
45 |
|
---|
46 | #ifndef RC_INVOKED
|
---|
47 | #ifdef __cplusplus
|
---|
48 | extern "C" {
|
---|
49 | #endif
|
---|
50 | typedef signed char INT8;
|
---|
51 | typedef signed short INT16;
|
---|
52 | typedef int LONG32, *PLONG32;
|
---|
53 | #ifndef XFree86Server
|
---|
54 | typedef int INT32, *PINT32;
|
---|
55 | #endif /* ndef XFree86Server */
|
---|
56 | typedef unsigned char UINT8;
|
---|
57 | typedef unsigned short UINT16;
|
---|
58 | typedef unsigned int ULONG32, *PULONG32;
|
---|
59 | typedef unsigned int DWORD32, *PDWORD32;
|
---|
60 | typedef unsigned int UINT32, *PUINT32;
|
---|
61 |
|
---|
62 | #if defined(_WIN64)
|
---|
63 | typedef __int64 INT_PTR, *PINT_PTR;
|
---|
64 | typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
|
---|
65 | typedef __int64 LONG_PTR, *PLONG_PTR;
|
---|
66 | typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
|
---|
67 | typedef unsigned __int64 HANDLE_PTR;
|
---|
68 | typedef unsigned int UHALF_PTR, *PUHALF_PTR;
|
---|
69 | typedef int HALF_PTR, *PHALF_PTR;
|
---|
70 |
|
---|
71 | #if 0 /* TODO when WIN64 is here */
|
---|
72 | inline unsigned long HandleToUlong(const void* h )
|
---|
73 | { return((unsigned long) h ); }
|
---|
74 | inline long HandleToLong( const void* h )
|
---|
75 | { return((long) h ); }
|
---|
76 | inline void* LongToHandle( const long h )
|
---|
77 | { return((void*) (INT_PTR) h ); }
|
---|
78 | inline unsigned long PtrToUlong( const void* p)
|
---|
79 | { return((unsigned long) p ); }
|
---|
80 | inline unsigned int PtrToUint( const void* p )
|
---|
81 | { return((unsigned int) p ); }
|
---|
82 | inline unsigned short PtrToUshort( const void* p )
|
---|
83 | { return((unsigned short) p ); }
|
---|
84 | inline long PtrToLong( const void* p )
|
---|
85 | { return((long) p ); }
|
---|
86 | inline int PtrToInt( const void* p )
|
---|
87 | { return((int) p ); }
|
---|
88 | inline short PtrToShort( const void* p )
|
---|
89 | { return((short) p ); }
|
---|
90 | inline void* IntToPtr( const int i )
|
---|
91 | { return( (void*)(INT_PTR)i ); }
|
---|
92 | inline void* UIntToPtr(const unsigned int ui)
|
---|
93 | { return( (void*)(UINT_PTR)ui ); }
|
---|
94 | inline void* LongToPtr( const long l )
|
---|
95 | { return( (void*)(LONG_PTR)l ); }
|
---|
96 | inline void* ULongToPtr( const unsigned long ul )
|
---|
97 | { return( (void*)(ULONG_PTR)ul ); }
|
---|
98 | #endif /* 0_ */
|
---|
99 |
|
---|
100 | #else /* !_WIN64 */
|
---|
101 | typedef int INT_PTR, *PINT_PTR;
|
---|
102 | typedef unsigned int UINT_PTR, *PUINT_PTR;
|
---|
103 | typedef long LONG_PTR, *PLONG_PTR;
|
---|
104 | typedef unsigned long ULONG_PTR, *PULONG_PTR;
|
---|
105 | typedef unsigned short UHALF_PTR, *PUHALF_PTR;
|
---|
106 | typedef short HALF_PTR, *PHALF_PTR;
|
---|
107 | typedef unsigned long HANDLE_PTR;
|
---|
108 | #endif /* !_WIN64 */
|
---|
109 |
|
---|
110 | typedef ULONG_PTR SIZE_T, *PSIZE_T;
|
---|
111 | typedef LONG_PTR SSIZE_T, *PSSIZE_T;
|
---|
112 | typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
|
---|
113 | typedef __int64 LONG64, *PLONG64;
|
---|
114 | typedef __int64 INT64, *PINT64;
|
---|
115 | typedef unsigned __int64 ULONG64, *PULONG64;
|
---|
116 | typedef unsigned __int64 DWORD64, *PDWORD64;
|
---|
117 | typedef unsigned __int64 UINT64, *PUINT64;
|
---|
118 | #ifdef __cplusplus
|
---|
119 | }
|
---|
120 | #endif
|
---|
121 | #endif /* !RC_INVOKED */
|
---|
122 |
|
---|
123 | #endif /* _BASETSD_H */
|
---|