Mercurial > hg > th-libs
comparison th_types.h @ 575:ebdfc1fe1c98
Fixes to the type definitions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jan 2020 18:17:29 +0200 |
parents | 7c0aa6bf484a |
children | ac2947ac9ef8 |
comparison
equal
deleted
inserted
replaced
574:872d2a65ce56 | 575:ebdfc1fe1c98 |
---|---|
22 # define TH_PLAT_UNIX 1 | 22 # define TH_PLAT_UNIX 1 |
23 #endif | 23 #endif |
24 | 24 |
25 | 25 |
26 // Check for standard headers | 26 // Check for standard headers |
27 #if defined(HAVE_STDINT_H) | 27 #if defined(HAVE_INTTYPES_H) |
28 # include <inttypes.h> | |
29 # ifndef HAVE_STDINT_H | |
30 # define HAVE_STDINT_H 1 | |
31 # endif | |
32 #elif defined(HAVE_STDINT_H) | |
28 # include <stdint.h> | 33 # include <stdint.h> |
29 # ifndef HAVE_INT_TYPES | |
30 # define HAVE_INT_TYPES 1 | |
31 # endif | |
32 #elif defined(HAVE_SYS_TYPES_H) | 34 #elif defined(HAVE_SYS_TYPES_H) |
33 # include <sys/types.h> | 35 # include <sys/types.h> |
34 # ifndef HAVE_INT_TYPES | |
35 # define HAVE_INT_TYPES 1 | |
36 # endif | |
37 #endif | 36 #endif |
38 | 37 |
39 #ifdef HAVE_INTTYPES_H | |
40 # include <inttypes.h> | |
41 #endif | |
42 | 38 |
43 | 39 |
44 // Check for arch bitness | 40 // Check for arch bitness |
45 #if !defined(TH_ARCH) && (defined(__WIN64) || defined(_WIN64)) | 41 #if !defined(TH_ARCH) && (defined(__WIN64) || defined(_WIN64)) |
46 # define TH_ARCH 64 | 42 # define TH_ARCH 64 |
121 #else | 117 #else |
122 # error Could not determine architecture (32/64bit), please define TH_ARCH=32 or 64 | 118 # error Could not determine architecture (32/64bit), please define TH_ARCH=32 or 64 |
123 #endif | 119 #endif |
124 | 120 |
125 | 121 |
126 // Shorthand types | 122 /* Default assumptions for these types should be ok for most 32/64bit platforms... |
127 typedef unsigned long int ulint_t; | |
128 typedef signed long int lint_t; | |
129 #ifndef HAVE_UINT_T // BOOST defines uint_t at least | |
130 typedef unsigned int uint_t; | |
131 #endif | |
132 | |
133 /* Default assumptions for these types should be ok for most 32bit platforms... | |
134 * feel free to define TH_TYPE_* if necessary to remedy | |
135 */ | 123 */ |
136 #ifdef TH_TYPE_I8 | 124 #ifndef HAVE_STDINT_H |
137 typedef unsigned TH_TYPE_I8 uint8_t; // 8 bits, unsigned | |
138 typedef signed TH_TYPE_I8 int8_t; // 8 bits, signed | |
139 #elif !defined(HAVE_INT_TYPES) | |
140 typedef unsigned char uint8_t; | 125 typedef unsigned char uint8_t; |
141 typedef signed char int8_t; | 126 typedef signed char int8_t; |
142 #endif | |
143 | |
144 | |
145 #ifdef TH_TYPE_I16 | |
146 typedef unsigned TH_TYPE_I16 uint16_t; // 16 bits, unsigned == 2 BYTEs | |
147 typedef signed TH_TYPE_I16 int16_t; // 16 bits, signed | |
148 #elif !defined(HAVE_INT_TYPES) | |
149 typedef unsigned short int uint16_t; | 127 typedef unsigned short int uint16_t; |
150 typedef signed short int int16_t; | 128 typedef signed short int int16_t; |
151 #endif | |
152 | |
153 #ifdef TH_TYPE_I32 | |
154 typedef unsigned TH_TYPE_I32 uint32_t; // 32 bits, unsigned == 4 BYTES == 2 WORDs | |
155 typedef signed TH_TYPE_I32 int32_t; // 32 bits, signed | |
156 #elif !defined(HAVE_INT_TYPES) | |
157 typedef unsigned int uint32_t; | 129 typedef unsigned int uint32_t; |
158 typedef signed int int32_t; | 130 typedef signed int int32_t; |
159 #endif | |
160 | |
161 #ifdef TH_TYPE_I64 | |
162 typedef unsigned TH_TYPE_I64 uint64_t; // 64 bits, unsigned == 8 BYTES == 2 DWORDs | |
163 typedef signed TH_TYPE_I64 int64_t; // 64 bits, signed | |
164 #elif !defined(HAVE_INT_TYPES) | |
165 typedef unsigned long long uint64_t; | 131 typedef unsigned long long uint64_t; |
166 typedef signed long long int64_t; | 132 typedef signed long long int64_t; |
167 #endif | |
168 | 133 |
169 | |
170 #ifndef HAVE_INT_TYPES | |
171 #if TH_ARCH == 32 | 134 #if TH_ARCH == 32 |
172 typedef long long int intmax_t; | 135 typedef long long int intmax_t; |
173 typedef unsigned long long int uintmax_t; | 136 typedef unsigned long long int uintmax_t; |
174 #elif TH_ARCH == 64 | 137 #elif TH_ARCH == 64 |
175 typedef long int intmax_t; | 138 typedef long int intmax_t; |