Commit | Line | Data |
7214af3e |
1 | // License information for this code is in license.txt |
2 | |
1c63ef2a |
3 | #ifndef SFTYPES_INCLUDED |
4 | #define SFTYPES_INCLUDED |
5 | |
e0b276af |
6 | #if defined(_WIN32) || defined(_WIN64) |
7 | |
1c63ef2a |
8 | typedef signed char Int8; |
9 | typedef signed short Int16; |
10 | typedef signed long Int32; |
11 | typedef signed __int64 Int64; |
12 | |
e0b276af |
13 | #ifdef _WIN64 |
14 | typedef signed __int64 IntPtr; |
15 | #else |
16 | typedef signed int IntPtr; |
17 | #endif |
18 | |
1c63ef2a |
19 | typedef unsigned char UInt8; |
20 | typedef unsigned short UInt16; |
21 | typedef unsigned long UInt32; |
22 | typedef unsigned __int64 UInt64; |
23 | |
e0b276af |
24 | #ifdef _WIN64 |
25 | typedef unsigned __int64 UIntPtr; |
26 | #else |
27 | typedef unsigned int UIntPtr; |
28 | #endif |
29 | |
30 | #else |
31 | |
32 | #include <stdint.h> |
33 | |
34 | typedef int8_t Int8; |
35 | typedef int16_t Int16; |
36 | typedef int32_t Int32; |
37 | typedef int64_t Int64; |
38 | typedef intptr_t IntPtr; |
39 | |
40 | typedef uint8_t UInt8; |
41 | typedef uint16_t UInt16; |
42 | typedef uint32_t UInt32; |
43 | typedef uint64_t UInt64; |
44 | typedef uintptr_t UIntPtr; |
45 | |
46 | #endif |
47 | |
1c63ef2a |
48 | union IntConv { |
49 | Int8 i8[8]; |
50 | UInt8 ui8[8]; |
51 | Int16 i16[4]; |
52 | UInt16 ui16[4]; |
53 | Int32 i32[2]; |
54 | UInt32 ui32[2]; |
55 | Int64 i64; |
56 | UInt64 ui64; |
57 | }; |
58 | |
a36705ea |
59 | #define SplitUInt64(L_Low, L_High, R) \ |
60 | L_Low = (UInt32)(R); \ |
61 | L_High = (UInt32)((R) >> 32); |
62 | |
212e7d69 |
63 | #define MakeUInt64(R_Low, R_High) ((UInt64)(R_Low) + ((UInt64)(R_High) << 32)) |
a36705ea |
64 | |
1c63ef2a |
65 | #endif // #ifndef SFTYPES_INCLUDED |
66 | |