forked from BlueQuartzSoftware/CMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmpPrimitiveTypes.h.in
executable file
·269 lines (220 loc) · 7.68 KB
/
cmpPrimitiveTypes.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*--------------------------------------------------------------------------
* This file is autogenerated from @CMP_SOURCE_DIR@/ConfiguredFiles/cmpPrimitiveTypes.h.in
* during the cmake
* configuration of your project. If you need to make changes, edit the
* original file NOT THIS FILE.
* --------------------------------------------------------------------------*/
#pragma once
#include "@CMP_CONFIGURATION_FILE_NAME@"
/* These typedefs are non-standard but sometimes they get used in various codes */
using float32 = float;
using float64 = double;
#if CMP_HAVE_STDINT_H
/* The ISO C99 standard specifies that in C++ implementations the Min/Max value
macros should only be defined if explicitly requested, so lets request them. */
#if __cplusplus
#if !defined(__STDC_LIMIT_MACROS)
#define __STDC_LIMIT_MACROS 1
#endif
#endif
#ifdef _MSVC_VER
#if (_MSVC_VER > 1700)
#include <cstdint>
#endif
#else
/* All UNIX style platforms */
#include <cstdint>
#endif
#else
/*--------------------------------------------------------------------------*/
/* Define named types and constants corresponding to specific integer
* and floating-point sizes and signedness. */
/* Select an 8-bit integer type. */
#if CMP_SIZEOF_CHAR == 1
#if defined (_MSVC_VER) || ( !defined(_UINT8_T) && (CMP_SIZEOF_UINT8_T == 0) )
#define _UINT8_T
typedef unsigned char uint8_t;
#endif /*_UINT8_T */
#if defined (_MSVC_VER) || ( !defined(_INT8_T) && (CMP_SIZEOF_INT8_T == 0) )
#define _INT8_T
typedef signed char int8_t;
#endif /*_INT8_T */
# define CMP_TYPE_UINT8 CMP_UNSIGNED_CHAR
#ifndef CMP_TYPE_INT8
# if CMP_TYPE_CHAR_IS_SIGNED
# define CMP_TYPE_INT8 CMP_CHAR
# else
# define CMP_TYPE_INT8 CMP_SIGNED_CHAR
# endif
#endif
#else /* CMP_SIZEOF_CHAR == 1 */
# error "No native data type can represent an 8-bit integer."
#endif
/* Select a 16-bit integer type. */
#if CMP_SIZEOF_SHORT == 2
#if defined (_MSVC_VER) || ( !defined(_UINT16_T) && (CMP_SIZEOF_UINT16_T == 0) )
#define _UINT16_T
typedef unsigned short uint16_t;
#endif /* _UINT16_T */
#if defined (_MSVC_VER) || ( !defined(_INT16_T) && (CMP_SIZEOF_INT16_T == 0) )
#define _INT16_T
typedef short int16_t;
#endif /* _INT16_T */
# define CMP_TYPE_UINT16 CMP_UNSIGNED_SHORT
# define CMP_TYPE_INT16 CMP_SHORT
#elif CMP_SIZEOF_INT == 2
#ifndef _UINT16_T && !defined CMP_SIZEOF_UINT16_T)
#define _UINT16_T
typedef unsigned int uint16_t;
#endif /* _UINT16_T */
#if !defined(_INT16_T) && !defined(CMP_SIZEOF_INT16_T)
#define _INT16_T
typedef int int16_t;
#endif /* _INT16_T */
# define CMP_TYPE_UINT16 CMP_UNSIGNED_INT
# define CMP_TYPE_INT16 CMP_INT
#else
# error "No native data type can represent a 16-bit integer."
#endif
/* Select a 32-bit integer type. */
#if CMP_SIZEOF_INT == 4
#if defined (_MSVC_VER) || ( !defined(_UINT32_T) && (CMP_SIZEOF_UINT32_T == 0) )
#define _UINT32_T
typedef unsigned int uint32_t;
#endif /* _UINT32_T */
#if defined (_MSVC_VER) || ( !defined(_INT32_T) && (CMP_SIZEOF_INT32_T == 0) )
#define _INT32_T
typedef int int32_t;
#endif /* _INT32_T */
# define CMP_TYPE_UINT32 CMP_UNSIGNED_INT
# define CMP_TYPE_INT32 CMP_INT
#elif CMP_SIZEOF_LONG == 4
#if !defined(_UINT32_T) && !defined CMP_SIZEOF_UINT32_T || defined (_MSVC_VER)
#define _UINT32_T
typedef unsigned long uint32_t;
#endif /* _UINT32_T */
#if !defined(_INT32_T) && !defined(CMP_SIZEOF_INT32_T) || defined (_MSVC_VER)
#define _INT32_T
typedef long int32_t;
#endif /* _INT32_T */
# define CMP_TYPE_UINT32 CMP_UNSIGNED_LONG
# define CMP_TYPE_INT32 CMP_LONG
#else
# error "No native data type can represent a 32-bit integer."
#endif
/* Select a 64-bit integer type. */
#if !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
# define D_OS_WIN32
# define D_OS_WIN64
#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
# define D_OS_WIN32
#endif
#if defined(D_OS_WIN32) || defined(D_OS_WIN64) || defined(D_OS_WINCE)
# define D_OS_WIN
#endif
#if defined(D_OS_WIN) && !defined(__GNUC__)
typedef __int64 int64_t; /* 64 bit signed */
typedef unsigned __int64 uint64_t; /* 64 bit unsigned */
#define _INT64_T
#define _UINT64_T
#else
#if CMP_SIZEOF_INT64_T == 0
typedef long long int64_t; /* 64 bit signed */
typedef unsigned long long uint64_t; /* 64 bit unsigned */
#define _INT64_T
#define _UINT64_T
#endif
#endif
#if 1
#if defined(CMP_TYPE_USE_LONG_LONG) && CMP_SIZEOF_LONG_LONG == 8
#if !defined(_UINT64_T) && (CMP_SIZEOF_UINT64_T == 0)
#define _UINT64_T
typedef unsigned long long uint64_t;
#endif /* _UINT64_T */
#if !defined(_INT64_T) && (CMP_SIZEOF_INT64_T == 0)
#define _INT64_T
typedef long long int64_t;
#endif /* _INT64_T */
# define CMP_TYPE_UINT64 CMP_UNSIGNED_LONG_LONG
# define CMP_TYPE_INT64 CMP_LONG_LONG
#elif CMP_SIZEOF_LONG == 8
#if !defined(_UINT64_T) && !defined(CMP_SIZEOF_UINT64_T) || defined (_MSVC_VER)
#define _UINT64_T
typedef unsigned long uint64_t;
#endif /* _UINT64_T */
#if !defined(_INT64_T) && !defined(CMP_SIZEOF_INT64_T) || defined (_MSVC_VER)
#define _INT64_T
typedef long int64_t;
#endif /* _INT64_T */
# define CMP_TYPE_UINT64 CMP_UNSIGNED_LONG
# define CMP_TYPE_INT64 CMP_LONG
#elif defined(CMP_TYPE_USE___INT64) && CMP_SIZEOF___INT64 == 8
#if !defined(_UINT64_T) && !defined(CMP_SIZEOF_UINT64_T) || defined (_MSVC_VER)
#define _UINT64_T
typedef unsigned __int64 uint64;
#endif /* _UINT64_T */
#if !defined(_INT64_T) && !defined(CMP_SIZEOF_INT64_T) || defined (_MSVC_VER)
#define _INT64_T
typedef signed __int64 int64;
#endif /* _INT64_T */
# define CMP_TYPE_UINT64 CMP_UNSIGNED___INT64
# define CMP_TYPE_INT64 CMP___INT64
#else
# error "No native data type can represent a 64-bit integer."
#endif
#endif
/* Select a 32-bit floating point type. */
#if CMP_SIZEOF_FLOAT == 4
typedef float float32;
# define CMP_TYPE_FLOAT32 CMP_FLOAT
#else
# error "No native data type can represent a 32-bit floating point value."
#endif
/* Select a 64-bit floating point type. */
#if CMP_SIZEOF_DOUBLE == 8
typedef double float64;
# define CMP_TYPE_FLOAT64 CMP_DOUBLE
#else
# error "No native data type can represent a 64-bit floating point value."
#endif
/* For those operating systems that don't actually have a stdint.h file, this section
* is taken from an OS X stdint.h file and should work just fine with the include
* guard.
*/
#ifndef CMP_HAVE_STDINT_H
/* 7.18.2 Limits of specified-width integer types:
* These #defines specify the minimum and maximum limits
* of each of the types declared above.
*/
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX 9223372036854775807LL
#define INT8_MIN -128
#define INT16_MIN -32768
/*
Note: the literal "most negative int" cannot be written in C --
the rules in the standard (section 6.4.4.1 in C99) will give it
an unsigned type, so INT32_MIN (and the most negative member of
any larger signed type) must be written via a constant expression.
*/
#define INT32_MIN (-INT32_MAX-1)
#define INT64_MIN (-INT64_MAX-1)
#define UINT8_MAX 255
#define UINT16_MAX 65535
#define UINT32_MAX 4294967295U
#define UINT64_MAX 18446744073709551615ULL
/* 7.18.4 Macros for integer constants */
#define INT8_C(v) (v)
#define INT16_C(v) (v)
#define INT32_C(v) (v)
#define INT64_C(v) (v ## LL)
#define UINT8_C(v) (v ## U)
#define UINT16_C(v) (v ## U)
#define UINT32_C(v) (v ## U)
#define UINT64_C(v) (v ## ULL)
#define INTMAX_C(v) (v ## LL)
#define UINTMAX_C(v) (v ## ULL)
#endif
#endif