| 1 | // |
| 2 | // Types.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Core |
| 6 | // Module: Types |
| 7 | // |
| 8 | // Definitions of fixed-size integer types for various platforms |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_Types_INCLUDED |
| 18 | #define Foundation_Types_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Foundation.h" |
| 22 | #include <cstdint> |
| 23 | |
| 24 | |
| 25 | #define POCO_HAVE_INT64 1 |
| 26 | |
| 27 | |
| 28 | namespace Poco { |
| 29 | |
| 30 | |
| 31 | typedef std::int8_t Int8; |
| 32 | typedef std::uint8_t UInt8; |
| 33 | typedef std::int16_t Int16; |
| 34 | typedef std::uint16_t UInt16; |
| 35 | typedef std::int32_t Int32; |
| 36 | typedef std::uint32_t UInt32; |
| 37 | typedef std::int64_t Int64; |
| 38 | typedef std::uint64_t UInt64; |
| 39 | |
| 40 | |
| 41 | #if defined(_MSC_VER) |
| 42 | // |
| 43 | // Windows/Visual C++ |
| 44 | // |
| 45 | |
| 46 | #if defined(_WIN64) |
| 47 | #define POCO_PTR_IS_64_BIT 1 |
| 48 | typedef std::int64_t IntPtr; |
| 49 | typedef std::uint64_t UIntPtr; |
| 50 | #else |
| 51 | typedef std::int32_t IntPtr; |
| 52 | typedef std::uint32_t UIntPtr; |
| 53 | #endif |
| 54 | |
| 55 | #elif defined(__GNUC__) || defined(__clang__) |
| 56 | // |
| 57 | // Unix/GCC/Clang |
| 58 | // |
| 59 | |
| 60 | #if defined(_WIN64) |
| 61 | #define POCO_PTR_IS_64_BIT 1 |
| 62 | typedef std::int64_t IntPtr; |
| 63 | typedef std::uint64_t UIntPtr; |
| 64 | #else |
| 65 | #if defined(__LP64__) |
| 66 | typedef std::int64_t IntPtr; |
| 67 | typedef std::uint64_t UIntPtr; |
| 68 | #define POCO_PTR_IS_64_BIT 1 |
| 69 | #define POCO_LONG_IS_64_BIT 1 |
| 70 | #else |
| 71 | typedef std::int32_t IntPtr; |
| 72 | typedef std::uint32_t UIntPtr; |
| 73 | #endif |
| 74 | #endif |
| 75 | |
| 76 | #elif defined(__DECCXX) |
| 77 | // |
| 78 | // Compaq C++ |
| 79 | // |
| 80 | |
| 81 | typedef Int64 IntPtr; |
| 82 | typedef UInt64 UIntPtr; |
| 83 | #define POCO_PTR_IS_64_BIT 1 |
| 84 | #define POCO_LONG_IS_64_BIT 1 |
| 85 | |
| 86 | #elif defined(__HP_aCC) |
| 87 | // |
| 88 | // HP Ansi C++ |
| 89 | // |
| 90 | |
| 91 | #if defined(__LP64__) |
| 92 | #define POCO_PTR_IS_64_BIT 1 |
| 93 | #define POCO_LONG_IS_64_BIT 1 |
| 94 | typedef Int64 IntPtr; |
| 95 | typedef UInt64 UIntPtr; |
| 96 | #else |
| 97 | typedef Int32 IntPtr; |
| 98 | typedef UInt32 UIntPtr; |
| 99 | #endif |
| 100 | |
| 101 | #elif defined(__SUNPRO_CC) |
| 102 | // |
| 103 | // SUN Forte C++ |
| 104 | // |
| 105 | |
| 106 | #if defined(__sparcv9) |
| 107 | #define POCO_PTR_IS_64_BIT 1 |
| 108 | #define POCO_LONG_IS_64_BIT 1 |
| 109 | typedef Int64 IntPtr; |
| 110 | typedef UInt64 UIntPtr; |
| 111 | #else |
| 112 | typedef Int32 IntPtr; |
| 113 | typedef UInt32 UIntPtr; |
| 114 | #endif |
| 115 | |
| 116 | #elif defined(__IBMCPP__) |
| 117 | // |
| 118 | // IBM XL C++ |
| 119 | // |
| 120 | |
| 121 | #if defined(__64BIT__) |
| 122 | #define POCO_PTR_IS_64_BIT 1 |
| 123 | #define POCO_LONG_IS_64_BIT 1 |
| 124 | typedef Int64 IntPtr; |
| 125 | typedef UInt64 UIntPtr; |
| 126 | #else |
| 127 | typedef Int32 IntPtr; |
| 128 | typedef UInt32 UIntPtr; |
| 129 | #endif |
| 130 | |
| 131 | #elif defined(__sgi) |
| 132 | // |
| 133 | // MIPSpro C++ |
| 134 | // |
| 135 | |
| 136 | #if _MIPS_SZLONG == 64 |
| 137 | #define POCO_PTR_IS_64_BIT 1 |
| 138 | #define POCO_LONG_IS_64_BIT 1 |
| 139 | typedef Int64 IntPtr; |
| 140 | typedef UInt64 UIntPtr; |
| 141 | #else |
| 142 | typedef Int32 IntPtr; |
| 143 | typedef UInt32 UIntPtr; |
| 144 | #endif |
| 145 | |
| 146 | #endif |
| 147 | |
| 148 | |
| 149 | #if defined(POCO_PTR_IS_64_BIT) && (POCO_PTR_IS_64_BIT == 1) |
| 150 | #define POCO_64_BIT |
| 151 | #endif |
| 152 | |
| 153 | |
| 154 | } // namespace Poco |
| 155 | |
| 156 | |
| 157 | #endif // Foundation_Types_INCLUDED |
| 158 | |