Commit | Line | Data |
c3242ac4 |
1 | /* |
2 | Copyright (c) 2002-2013, ShadowFlare <blakflare@hotmail.com> |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions |
7 | are met: |
8 | |
9 | 1. Redistributions of source code must retain the above copyright |
10 | notice, this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND |
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | SUCH DAMAGE. |
26 | */ |
27 | |
cfca19c6 |
28 | #ifndef SFTYPES_INCLUDED |
29 | #define SFTYPES_INCLUDED |
30 | |
31 | #if defined(_WIN32) || defined(_WIN64) |
32 | |
33 | typedef signed char Int8; |
34 | typedef signed short Int16; |
35 | typedef signed long Int32; |
36 | typedef signed __int64 Int64; |
37 | |
38 | #ifdef _WIN64 |
39 | typedef signed __int64 IntPtr; |
40 | #else |
41 | typedef signed int IntPtr; |
42 | #endif |
43 | |
44 | typedef unsigned char UInt8; |
45 | typedef unsigned short UInt16; |
46 | typedef unsigned long UInt32; |
47 | typedef unsigned __int64 UInt64; |
48 | |
49 | #ifdef _WIN64 |
50 | typedef unsigned __int64 UIntPtr; |
51 | #else |
52 | typedef unsigned int UIntPtr; |
53 | #endif |
54 | |
55 | #else |
56 | |
57 | #include <stdint.h> |
58 | |
59 | typedef int8_t Int8; |
60 | typedef int16_t Int16; |
61 | typedef int32_t Int32; |
62 | typedef int64_t Int64; |
63 | typedef intptr_t IntPtr; |
64 | |
65 | typedef uint8_t UInt8; |
66 | typedef uint16_t UInt16; |
67 | typedef uint32_t UInt32; |
68 | typedef uint64_t UInt64; |
69 | typedef uintptr_t UIntPtr; |
70 | |
71 | #endif |
72 | |
73 | union IntConv { |
74 | Int8 i8[8]; |
75 | UInt8 ui8[8]; |
76 | Int16 i16[4]; |
77 | UInt16 ui16[4]; |
78 | Int32 i32[2]; |
79 | UInt32 ui32[2]; |
80 | Int64 i64; |
81 | UInt64 ui64; |
82 | }; |
83 | |
84 | #endif // #ifndef SFTYPES_INCLUDED |