Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Basic_Types.h
blobcccde07113f0f16e94446d1765fb0c87960a990c
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Basic_Types.h
7 * @author David L. Levine
9 * #defines the list of preprocessor macros below. The config.h file can
10 * pre-define any of these to short-cut the definitions. This is usually
11 * only necessary if the preprocessor does all of its math using integers.
13 * Sizes of built-in types:
14 * - ACE_SIZEOF_CHAR
15 * - ACE_SIZEOF_WCHAR
16 * - ACE_SIZEOF_SHORT
17 * - ACE_SIZEOF_INT
18 * - ACE_SIZEOF_LONG
19 * - ACE_SIZEOF_LONG_LONG
20 * - ACE_SIZEOF_VOID_P
21 * - ACE_SIZEOF_FLOAT
22 * - ACE_SIZEOF_DOUBLE
23 * - ACE_SIZEOF_LONG_DOUBLE
25 * Wrappers for built-in types of specific sizes:
26 * - ACE_INT8
27 * - ACE_UINT8
28 * - ACE_INT16
29 * - ACE_UINT16
30 * - ACE_INT32
31 * - ACE_UINT32
32 * - ACE_INT64
33 * - ACE_UINT64
35 * Byte-order (endian-ness) determination:
36 * ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN
38 //=============================================================================
40 #include /**/ "ace/config-lite.h"
42 #ifndef ACE_BASIC_TYPES_H
43 # define ACE_BASIC_TYPES_H
45 # include /**/ "ace/pre.h"
47 # if !defined (ACE_LACKS_PRAGMA_ONCE)
48 # pragma once
49 # endif /* ACE_LACKS_PRAGMA_ONCE */
51 // Pull in definitions
52 # include "ace/os_include/os_limits.h" // Integer limits
53 # include "ace/os_include/os_float.h" // Floating point limits
54 # include "ace/os_include/os_stdlib.h" // Other types
55 # include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below
56 # include "ace/os_include/arpa/os_inet.h" // For htons
58 # include "ace/os_include/sys/os_types.h"
60 # if !defined (ACE_LACKS_SYS_PARAM_H)
61 # include /**/ <sys/param.h>
62 # endif /* ACE_LACKS_SYS_PARAM_H */
64 # include "ace/ACE_export.h"
66 # if !defined (ACE_LACKS_STDINT_H)
67 # include <stdint.h>
68 # endif
69 # if !defined (ACE_LACKS_INTTYPES_H)
70 # include <inttypes.h>
71 # endif
73 #ifdef ACE_LACKS_INTPTR_T
74 # include "ace/If_Then_Else.h"
76 // This intptr_t typedef is here instead of
77 // <ace/os_include/os_inttypes.h> since it depends on the template
78 // metaprogramming in <ace/If_Then_Else.h>.
80 // We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc.
81 // However, that depends on the ACE preprocessor symbol definitions in
82 // the platform-specific configuration header being correct.
83 // The template meta-programming approach we take below,
84 // i.e. determining the type at compile-time rather than at
85 // preprocessing-time, will work for all platforms, and does not
86 // depend on ACE developer-defined configuration parameters.
87 typedef ACE::If_Then_Else<
88 (sizeof (void*) == sizeof (signed int)),
89 signed int,
90 ACE::If_Then_Else<
91 (sizeof (void*) == sizeof (signed long)),
92 signed long,
93 ACE::If_Then_Else<
94 (sizeof (void*) == sizeof (signed long long)),
95 signed long long,
96 void /* Unknown. Force an invalid type */
97 >::result_type
98 >::result_type
99 >::result_type intptr_t;
101 typedef ACE::If_Then_Else<
102 (sizeof (void*) == sizeof (unsigned int)),
103 unsigned int,
104 ACE::If_Then_Else<
105 (sizeof (void*) == sizeof (unsigned long)),
106 unsigned long,
107 ACE::If_Then_Else<
108 (sizeof (void*) == sizeof (unsigned long long)),
109 unsigned long long,
110 void /* Unknown. Force an invalid type */
111 >::result_type
112 >::result_type
113 >::result_type uintptr_t;
115 #endif /* ACE_LACKS_INTPTR_T */
117 // A char always has 1 byte, by definition.
118 # define ACE_SIZEOF_CHAR 1
120 // Unfortunately, there isn't a portable way to determine the size of a wchar.
121 // So we just define them on a platform basis. If the platform doesn't
122 // define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code
123 // uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid.
124 // If the platform config doesn't set this, and this guess is wrong,
125 // Basic_Types_Test should catch the inconsistency.
126 # if defined (ACE_HAS_WCHAR)
127 # if !defined (ACE_SIZEOF_WCHAR)
128 # if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
129 # define ACE_SIZEOF_WCHAR 4
130 # else
131 // 0 so the Basic_Types test will catch this.
132 # define ACE_SIZEOF_WCHAR 0
133 # endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
134 # endif /* !ACE_SIZEOF_WCHAR */
135 # endif /* ACE_HAS_WCHAR */
137 // The number of bytes in a short.
138 # if !defined (ACE_SIZEOF_SHORT)
139 # if (USHRT_MAX) == 255U
140 # define ACE_SIZEOF_SHORT 1
141 # elif (USHRT_MAX) == 65535U
142 # define ACE_SIZEOF_SHORT 2
143 # elif (USHRT_MAX) == 4294967295U
144 # define ACE_SIZEOF_SHORT 4
145 # elif (USHRT_MAX) == 18446744073709551615U
146 # define ACE_SIZEOF_SHORT 8
147 # else
148 # error: unsupported short size, must be updated for this platform!
149 # endif /* USHRT_MAX */
150 # endif /* !defined (ACE_SIZEOF_SHORT) */
152 // The number of bytes in an int.
153 # if !defined (ACE_SIZEOF_INT)
154 # if (UINT_MAX) == 65535U
155 # define ACE_SIZEOF_INT 2
156 # elif (UINT_MAX) == 4294967295U
157 # define ACE_SIZEOF_INT 4
158 # elif (UINT_MAX) == 18446744073709551615U
159 # define ACE_SIZEOF_INT 8
160 # else
161 # error: unsupported int size, must be updated for this platform!
162 # endif /* UINT_MAX */
163 # endif /* !defined (ACE_SIZEOF_INT) */
165 // The number of bytes in a long.
166 # if !defined (ACE_SIZEOF_LONG)
167 # if (ULONG_MAX) == 65535UL
168 # define ACE_SIZEOF_LONG 2
169 # elif ((ULONG_MAX) == 4294967295UL)
170 # define ACE_SIZEOF_LONG 4
171 # elif ((ULONG_MAX) == 18446744073709551615UL)
172 # define ACE_SIZEOF_LONG 8
173 # else
174 # error: unsupported long size, must be updated for this platform!
175 # endif /* ULONG_MAX */
176 # endif /* !defined (ACE_SIZEOF_LONG) */
178 // The number of bytes in a long long.
179 # if !defined (ACE_SIZEOF_LONG_LONG)
180 # if defined (ULLONG_MAX)
181 # if ((ULLONG_MAX) == 4294967295ULL)
182 # define ACE_SIZEOF_LONG_LONG 4
183 # elif ((ULLONG_MAX) == 18446744073709551615ULL)
184 # define ACE_SIZEOF_LONG_LONG 8
185 # endif
186 # elif defined (ULONGLONG_MAX)
187 # if ((ULONGLONG_MAX) == 4294967295ULL)
188 # define ACE_SIZEOF_LONG_LONG 4
189 # elif ((ULONGLONG_MAX) == 18446744073709551615ULL)
190 # define ACE_SIZEOF_LONG_LONG 8
191 # endif
192 # endif
193 # // If we can't determine the size of long long, assume it is 8
194 # // instead of erroring out. (Either ULLONG_MAX and ULONGLONG_MAX
195 # // may not be supported; or an extended C/C++ dialect may need to
196 # // be selected. If this assumption is wrong, it can be addressed
197 # // in the platform-specific config header.
198 # if !defined (ACE_SIZEOF_LONG_LONG)
199 # define ACE_SIZEOF_LONG_LONG 8
200 # endif
201 # endif /* !defined (ACE_SIZEOF_LONG_LONG) */
203 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
205 // The sizes of the commonly implemented types are known.
206 typedef int8_t ACE_INT8;
207 typedef uint8_t ACE_UINT8;
208 typedef int16_t ACE_INT16;
209 typedef uint16_t ACE_UINT16;
210 typedef int32_t ACE_INT32;
211 typedef uint32_t ACE_UINT32;
212 typedef int64_t ACE_INT64;
213 typedef uint64_t ACE_UINT64;
215 /// Define a generic byte for use in codecs
216 typedef unsigned char ACE_Byte;
218 // Define a pseudo wide character type when wchar is not supported so we
219 // can support basic wide character string operations.
220 #if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
221 # define ACE_WINT_T wint_t
222 # define ACE_WCHAR_T wchar_t
223 #else
224 # define ACE_WINT_T ACE_UINT16
225 # define ACE_WCHAR_T ACE_UINT16
226 #endif /* ACE_HAS_WCHAR */
228 // The number of bytes in a void *.
229 #ifndef ACE_SIZEOF_VOID_P
230 # define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
231 #endif /* ACE_SIZEOF_VOID_P */
233 ACE_END_VERSIONED_NAMESPACE_DECL
235 // Byte-order (endian-ness) determination.
236 #if defined (BYTE_ORDER)
237 # if (BYTE_ORDER == LITTLE_ENDIAN)
238 # define ACE_LITTLE_ENDIAN 0x0123
239 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
240 # elif (BYTE_ORDER == BIG_ENDIAN)
241 # define ACE_BIG_ENDIAN 0x3210
242 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
243 # else
244 # error: unknown BYTE_ORDER!
245 # endif /* BYTE_ORDER */
246 #elif defined (_BYTE_ORDER)
247 # if (_BYTE_ORDER == _LITTLE_ENDIAN)
248 # define ACE_LITTLE_ENDIAN 0x0123
249 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
250 # elif (_BYTE_ORDER == _BIG_ENDIAN)
251 # define ACE_BIG_ENDIAN 0x3210
252 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
253 # else
254 # error: unknown _BYTE_ORDER!
255 # endif /* _BYTE_ORDER */
256 #elif defined (__BYTE_ORDER)
257 # if (__BYTE_ORDER == __LITTLE_ENDIAN)
258 # define ACE_LITTLE_ENDIAN 0x0123
259 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
260 # elif (__BYTE_ORDER == __BIG_ENDIAN)
261 # define ACE_BIG_ENDIAN 0x3210
262 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
263 # else
264 # error: unknown __BYTE_ORDER!
265 # endif /* __BYTE_ORDER */
266 #else /* ! BYTE_ORDER && ! __BYTE_ORDER */
267 // We weren't explicitly told, so we have to figure it out . . .
268 // Note that Itanium hardware (IA64) can run in either byte order. It's
269 // selected by the OS when loading; Windows runs little.
270 # if defined (i386) || defined (__i386__) || defined (_M_IX86) || \
271 defined (vax) || defined (__LITTLE_ENDIAN__) || \
272 defined (ARM) || defined (_M_IA64) || defined (_M_AMD64) || \
273 defined (__amd64) || \
274 ((defined (__ia64__) || defined (__ia64)))
275 // We know these are little endian.
276 # define ACE_LITTLE_ENDIAN 0x0123
277 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
278 # else
279 // Otherwise, we assume big endian.
280 # define ACE_BIG_ENDIAN 0x3210
281 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
282 # endif
283 #endif /* ! BYTE_ORDER && ! __BYTE_ORDER */
285 // Byte swapping macros to deal with differences between little endian
286 // and big endian machines. Note that "long" here refers to 32 bit
287 // quantities.
288 # define ACE_SWAP_LONG_LONG(LL) ((ACE_SWAP_LONG ((LL)&0xFFFFFFFF) << 32) \
289 | ACE_SWAP_LONG(((LL) >> 32) & 0xFFFFFFFF))
290 # define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
291 | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
292 # define ACE_SWAP_WORD(W) ((((W) & 0x00FF) << 8) | (((W) & 0xFF00) >> 8))
294 # define ACE_HTONL(X) htonl (X)
295 # define ACE_NTOHL(X) ntohl (X)
297 # if defined (ACE_LITTLE_ENDIAN)
298 # define ACE_IDL_NCTOHL(X) (X)
299 # define ACE_IDL_NSTOHL(X) (X)
300 # else
301 # define ACE_IDL_NCTOHL(X) (X << 24)
302 # define ACE_IDL_NSTOHL(X) ((X) << 16)
303 # endif /* ACE_LITTLE_ENDIAN */
305 // MQX doesn't define these macros correctly.
306 # if defined (ACE_LITTLE_ENDIAN) && defined (ACE_MQX)
307 # define ACE_HTONS(x) x
308 # define ACE_NTOHS(x) x
309 # else
310 # define ACE_HTONS(x) htons(x)
311 # define ACE_NTOHS(x) ntohs(x)
312 # endif
314 # define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
315 reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L))
317 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
319 inline ACE_UINT32
320 ACE_U64_TO_U32 (ACE_UINT64 n)
322 return static_cast<ACE_UINT32> (n);
325 inline ACE_UINT32
326 ACE_CU64_TO_CU32 (ACE_UINT64 n)
328 return static_cast<ACE_UINT32> (n);
331 ACE_END_VERSIONED_NAMESPACE_DECL
333 #if defined (ACE_WIN32)
334 # if defined (__MINGW32__)
335 # define ACE_UINT64_LITERAL(n) n ## ull
336 # define ACE_INT64_LITERAL(n) n ## ll
337 # else
338 # define ACE_UINT64_LITERAL(n) n ## ui64
339 # define ACE_INT64_LITERAL(n) n ## i64
340 # endif /* defined (__MINGW32__) */
341 #else /* ! ACE_WIN32 */
342 # define ACE_UINT64_LITERAL(n) n ## ull
343 # define ACE_INT64_LITERAL(n) n ## ll
344 #endif /* ! ACE_WIN32*/
346 #if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII)
347 # if defined (PRId8)
348 # define ACE_INT8_FORMAT_SPECIFIER_ASCII "%" PRId8
349 # else
350 # define ACE_INT8_FORMAT_SPECIFIER_ASCII "%d"
351 # endif /* defined (PRId8) */
352 #endif /* ACE_INT8_FORMAT_SPECIFIER_ASCII */
354 #if !defined (ACE_INT8_FORMAT_SPECIFIER)
355 # if defined (PRId8)
356 # define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8)
357 # else
358 # define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT (ACE_INT8_FORMAT_SPECIFIER_ASCII)
359 # endif /* defined (PRId8) */
360 #endif /* ACE_INT8_FORMAT_SPECIFIER */
362 #if !defined (ACE_UINT8_FORMAT_SPECIFIER_ASCII)
363 # if defined (PRIu8)
364 # define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%" PRIu8
365 # else
366 # define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%u"
367 # endif /* defined (PRIu8) */
368 #endif /* ACE_UINT8_FORMAT_SPECIFIER */
370 #if !defined (ACE_UINT8_FORMAT_SPECIFIER)
371 # if defined (PRIu8)
372 # define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8)
373 # else
374 # define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT8_FORMAT_SPECIFIER_ASCII)
375 # endif /* defined (PRIu8) */
376 #endif /* ACE_UINT8_FORMAT_SPECIFIER */
378 #if !defined (ACE_INT16_FORMAT_SPECIFIER_ASCII)
379 # if defined (PRId16)
380 # define ACE_INT16_FORMAT_SPECIFIER_ASCII "%" PRId16
381 # else
382 # define ACE_INT16_FORMAT_SPECIFIER_ASCII "%d"
383 # endif /* defined (PRId16) */
384 #endif /* ACE_INT16_FORMAT_SPECIFIER */
386 #if !defined (ACE_INT16_FORMAT_SPECIFIER)
387 # if defined (PRId16)
388 # define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16)
389 # else
390 # define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT (ACE_INT16_FORMAT_SPECIFIER_ASCII)
391 # endif /* defined (PRId16) */
392 #endif /* ACE_INT16_FORMAT_SPECIFIER */
394 #if !defined (ACE_UINT16_FORMAT_SPECIFIER_ASCII)
395 # if defined (PRIu16)
396 # define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%" PRIu16
397 # else
398 # define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%u"
399 # endif /* defined (PRIu16) */
400 #endif /* ACE_UINT16_FORMAT_SPECIFIER */
402 #if !defined (ACE_UINT16_FORMAT_SPECIFIER)
403 # if defined (PRIu16)
404 # define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16)
405 # else
406 # define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT16_FORMAT_SPECIFIER_ASCII)
407 # endif /* defined (PRIu16) */
408 #endif /* ACE_UINT16_FORMAT_SPECIFIER */
410 #if !defined (ACE_INT32_FORMAT_SPECIFIER_ASCII)
411 # if defined (PRId32)
412 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%" PRId32
413 # elif ACE_SIZEOF_INT == 4
414 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%d"
415 # else
416 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%ld"
417 # endif /* defined (PRId32) */
418 #endif /* ACE_INT32_FORMAT_SPECIFIER */
420 #if !defined (ACE_INT32_FORMAT_SPECIFIER)
421 # if defined (PRId32)
422 # define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32)
423 # else
424 # define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT (ACE_INT32_FORMAT_SPECIFIER_ASCII)
425 # endif /* defined (PRId32) */
426 #endif /* ACE_INT32_FORMAT_SPECIFIER */
428 #if !defined (ACE_UINT32_FORMAT_SPECIFIER_ASCII)
429 # if defined (PRIu32)
430 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%" PRIu32
431 # elif ACE_SIZEOF_INT == 4
432 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%u"
433 # else
434 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%lu"
435 # endif /* defined (PRIu32) */
436 #endif /* ACE_UINT32_FORMAT_SPECIFIER */
438 #if !defined (ACE_UINT32_FORMAT_SPECIFIER)
439 # if defined (PRIu32)
440 # define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32)
441 # else
442 # define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT32_FORMAT_SPECIFIER_ASCII)
443 # endif /* defined (PRIu32) */
444 #endif /* ACE_UINT32_FORMAT_SPECIFIER */
446 #if !defined (ACE_INT64_FORMAT_SPECIFIER_ASCII)
447 # if defined (PRId64)
448 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%" PRId64
449 # elif ACE_SIZEOF_LONG == 8
450 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%ld"
451 # else
452 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%lld"
453 # endif /* defined (PRId64) */
454 #endif /* ACE_INT64_FORMAT_SPECIFIER */
456 #if !defined (ACE_INT64_FORMAT_SPECIFIER)
457 # if defined (PRId64)
458 # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64)
459 # else
460 # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT (ACE_INT64_FORMAT_SPECIFIER_ASCII)
461 # endif /* defined (PRId64) */
462 #endif /* ACE_INT64_FORMAT_SPECIFIER */
464 #if !defined (ACE_UINT64_FORMAT_SPECIFIER_ASCII)
465 # if defined (PRIu64)
466 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%" PRIu64
467 # elif ACE_SIZEOF_LONG == 8
468 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu"
469 # else
470 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%llu"
471 # endif /* defined (PRIu64) */
472 #endif /* ACE_UINT64_FORMAT_SPECIFIER_ASCII */
474 #if !defined (ACE_UINT64_FORMAT_SPECIFIER)
475 # if defined (PRIu64)
476 # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64)
477 # else
478 # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT64_FORMAT_SPECIFIER_ASCII)
479 # endif /* defined (PRIu64) */
480 #endif /* ACE_UINT64_FORMAT_SPECIFIER */
482 #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII)
483 # if defined (ACE_WIN64)
484 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d"
485 # elif defined (_WRS_CONFIG_LP64)
486 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld"
487 # else
488 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d"
489 # endif /* ACE_WIN64 */
490 #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
492 #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
493 #define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII)
494 #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
496 #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII)
497 # if defined (ACE_WIN64)
498 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u"
499 # elif defined (_WRS_CONFIG_LP64)
500 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu"
501 # else
502 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u"
503 # endif /* ACE_WIN64 */
504 #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
506 #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
507 #define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII)
508 #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
510 // Cast from UINT64 to a double requires an intermediate cast to INT64
511 // on some platforms.
512 #if defined (ACE_WIN32)
513 # define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n)
514 #else /* ! ACE_WIN32 && */
515 # define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
516 #endif /* ! ACE_WIN32 && */
519 // The number of bytes in a float.
520 # ifndef ACE_SIZEOF_FLOAT
521 # if FLT_MAX_EXP == 128
522 # define ACE_SIZEOF_FLOAT 4
523 # elif FLT_MAX_EXP == 1024
524 # define ACE_SIZEOF_FLOAT 8
525 # else
526 # error: unsupported float size, must be updated for this platform!
527 # endif /* FLT_MAX_EXP */
528 # endif /* ACE_SIZEOF_FLOAT */
530 // The number of bytes in a double.
531 # ifndef ACE_SIZEOF_DOUBLE
532 # if DBL_MAX_EXP == 128
533 # define ACE_SIZEOF_DOUBLE 4
534 # elif DBL_MAX_EXP == 1024
535 # define ACE_SIZEOF_DOUBLE 8
536 # else
537 # error: unsupported double size, must be updated for this platform!
538 # endif /* DBL_MAX_EXP */
539 # endif /* ACE_SIZEOF_DOUBLE */
541 // The number of bytes in a long double.
542 # ifndef ACE_SIZEOF_LONG_DOUBLE
543 # if LDBL_MAX_EXP == 128
544 # define ACE_SIZEOF_LONG_DOUBLE 4
545 # elif LDBL_MAX_EXP == 1024
546 # if defined (__powerpc64__)
547 # define ACE_SIZEOF_LONG_DOUBLE 16
548 # else
549 # define ACE_SIZEOF_LONG_DOUBLE 8
550 # endif
551 # elif LDBL_MAX_EXP == 16384
552 # if defined (LDBL_DIG) && LDBL_DIG == 18
553 # if defined (__ia64) || defined (__x86_64)
554 # define ACE_SIZEOF_LONG_DOUBLE 16
555 # else /* ! __ia64 || __x86_64 */
556 # define ACE_SIZEOF_LONG_DOUBLE 12
557 # endif /* __ia64 */
558 # else /* ! LDBL_DIG || LDBL_DIG != 18 */
559 # define ACE_SIZEOF_LONG_DOUBLE 16
560 # endif /* ! LDBL_DIG || LDBL_DIG != 18 */
561 # else
562 # error: unsupported double size, must be updated for this platform!
563 # endif /* LDBL_MAX_EXP */
564 # endif /* ACE_SIZEOF_LONG_DOUBLE */
566 // Max and min sizes for the ACE integer types.
567 #define ACE_INT8_MAX 0x7F
568 #define ACE_INT8_MIN -(ACE_INT8_MAX) - 1
569 #define ACE_UINT8_MAX 0xFF
570 #define ACE_CHAR_MAX (ACE_INT8_MAX)
571 #define ACE_CHAR_MIN (ACE_INT8_MIN)
572 #define ACE_OCTET_MAX (ACE_UINT8_MAX)
573 #define ACE_INT16_MAX 0x7FFF
574 #define ACE_INT16_MIN -(ACE_INT16_MAX) - 1
575 #define ACE_UINT16_MAX 0xFFFF
576 #define ACE_WCHAR_MAX ACE_UINT16_MAX
577 #define ACE_INT32_MAX 0x7FFFFFFF
578 #define ACE_INT32_MIN -(ACE_INT32_MAX) - 1
579 #define ACE_UINT32_MAX 0xFFFFFFFF
580 #define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
581 #define ACE_INT64_MIN -(ACE_INT64_MAX) - 1
582 #define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
584 // These use ANSI/IEEE format.
585 #define ACE_FLT_MAX 3.402823466e+38F
586 #define ACE_FLT_MIN 1.175494351e-38F
587 #define ACE_FLT_LOWEST -(ACE_FLT_MAX)
588 #define ACE_DBL_MAX 1.7976931348623158e+308
589 #define ACE_DBL_MIN 2.2250738585072014e-308
590 #define ACE_DBL_LOWEST -(ACE_DBL_MAX)
592 # include /**/ "ace/post.h"
593 #endif /* ACE_BASIC_TYPES_H */