source: Daodan/MinGW/include/basetsd.h@ 1051

Last change on this file since 1051 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 3.9 KB
RevLine 
[1046]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
48extern "C" {
49#endif
50typedef signed char INT8;
51typedef signed short INT16;
52typedef int LONG32, *PLONG32;
53#ifndef XFree86Server
54typedef int INT32, *PINT32;
55#endif /* ndef XFree86Server */
56typedef unsigned char UINT8;
57typedef unsigned short UINT16;
58typedef unsigned int ULONG32, *PULONG32;
59typedef unsigned int DWORD32, *PDWORD32;
60typedef unsigned int UINT32, *PUINT32;
61
62#if defined(_WIN64)
63typedef __int64 INT_PTR, *PINT_PTR;
64typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
65typedef __int64 LONG_PTR, *PLONG_PTR;
66typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
67typedef unsigned __int64 HANDLE_PTR;
68typedef unsigned int UHALF_PTR, *PUHALF_PTR;
69typedef int HALF_PTR, *PHALF_PTR;
70
71#if 0 /* TODO when WIN64 is here */
72inline unsigned long HandleToUlong(const void* h )
73 { return((unsigned long) h ); }
74inline long HandleToLong( const void* h )
75 { return((long) h ); }
76inline void* LongToHandle( const long h )
77 { return((void*) (INT_PTR) h ); }
78inline unsigned long PtrToUlong( const void* p)
79 { return((unsigned long) p ); }
80inline unsigned int PtrToUint( const void* p )
81 { return((unsigned int) p ); }
82inline unsigned short PtrToUshort( const void* p )
83 { return((unsigned short) p ); }
84inline long PtrToLong( const void* p )
85 { return((long) p ); }
86inline int PtrToInt( const void* p )
87 { return((int) p ); }
88inline short PtrToShort( const void* p )
89 { return((short) p ); }
90inline void* IntToPtr( const int i )
91 { return( (void*)(INT_PTR)i ); }
92inline void* UIntToPtr(const unsigned int ui)
93 { return( (void*)(UINT_PTR)ui ); }
94inline void* LongToPtr( const long l )
95 { return( (void*)(LONG_PTR)l ); }
96inline void* ULongToPtr( const unsigned long ul )
97 { return( (void*)(ULONG_PTR)ul ); }
98#endif /* 0_ */
99
100#else /* !_WIN64 */
101typedef int INT_PTR, *PINT_PTR;
102typedef unsigned int UINT_PTR, *PUINT_PTR;
103typedef long LONG_PTR, *PLONG_PTR;
104typedef unsigned long ULONG_PTR, *PULONG_PTR;
105typedef unsigned short UHALF_PTR, *PUHALF_PTR;
106typedef short HALF_PTR, *PHALF_PTR;
107typedef unsigned long HANDLE_PTR;
108#endif /* !_WIN64 */
109
110typedef ULONG_PTR SIZE_T, *PSIZE_T;
111typedef LONG_PTR SSIZE_T, *PSSIZE_T;
112typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
113typedef __int64 LONG64, *PLONG64;
114typedef __int64 INT64, *PINT64;
115typedef unsigned __int64 ULONG64, *PULONG64;
116typedef unsigned __int64 DWORD64, *PDWORD64;
117typedef unsigned __int64 UINT64, *PUINT64;
118#ifdef __cplusplus
119}
120#endif
121#endif /* !RC_INVOKED */
122
123#endif /* _BASETSD_H */
Note: See TracBrowser for help on using the repository browser.