1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 #ifndef __COMMON_TYPES_H__
6 #define __COMMON_TYPES_H__
7 
8 #include <cstddef>
9 #include <cstdint>
10 #include <cstdlib>
11 #include <new>
12 
13 using std::nothrow;
14 using std::size_t;
15 using std::uintptr_t;
16 using std::intptr_t;
17 
18 //
19 // These type names are chosen to match the C# types
20 //
21 typedef int8_t              Int8;
22 typedef int16_t             Int16;
23 typedef int32_t             Int32;
24 typedef int64_t             Int64;
25 typedef uint8_t             UInt8;
26 typedef uint16_t            UInt16;
27 typedef uint32_t            UInt32;
28 typedef uint64_t            UInt64;
29 typedef intptr_t            IntNative;  // intentional deviation from C# IntPtr
30 typedef uintptr_t           UIntNative; // intentional deviation from C# UIntPtr
31 typedef wchar_t             WCHAR;
32 typedef void *              HANDLE;
33 
34 typedef unsigned char       Boolean;
35 #define Boolean_false 0
36 #define Boolean_true 1
37 
38 typedef UInt32              UInt32_BOOL;    // windows 4-byte BOOL, 0 -> false, everything else -> true
39 #define UInt32_FALSE        0
40 #define UInt32_TRUE         1
41 
42 #define UInt16_MAX          ((UInt16)0xffffU)
43 #define UInt16_MIN          ((UInt16)0x0000U)
44 
45 #define UInt32_MAX          ((UInt32)0xffffffffU)
46 #define UInt32_MIN          ((UInt32)0x00000000U)
47 
48 #define Int32_MAX           ((Int32)0x7fffffff)
49 #define Int32_MIN           ((Int32)0x80000000)
50 
51 #define UInt64_MAX          ((UInt64)0xffffffffffffffffUL)
52 #define UInt64_MIN          ((UInt64)0x0000000000000000UL)
53 
54 #endif // __COMMON_TYPES_H__
55