3 //=============================================================================
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:
19 * - ACE_SIZEOF_LONG_LONG
23 * - ACE_SIZEOF_LONG_DOUBLE
25 * Wrappers for built-in types of specific sizes:
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)
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)
69 # if !defined (ACE_LACKS_INTTYPES_H)
70 # include <inttypes.h>
73 # if defined (ACE_HAS_CPP11)
74 # define ACE_HAS_INT8_T
75 # define ACE_HAS_UINT8_T
76 # define ACE_HAS_INT16_T
77 # define ACE_HAS_UINT16_T
78 # define ACE_HAS_INT32_T
79 # define ACE_HAS_UINT32_T
80 # define ACE_HAS_INT64_T
81 # define ACE_HAS_UINT64_T
82 # endif /* ACE_HAS_CPP11 */
84 #ifdef ACE_LACKS_INTPTR_T
85 # include "ace/If_Then_Else.h"
87 // This intptr_t typedef is here instead of
88 // <ace/os_include/os_inttypes.h> since it depends on the template
89 // metaprogramming in <ace/If_Then_Else.h>.
91 // We could compare ACE_SIZEOF_VOID_P against ACE_SIZEOF_LONG, etc.
92 // However, that depends on the ACE preprocessor symbol definitions in
93 // the platform-specific configuration header being correct.
94 // The template meta-programming approach we take below,
95 // i.e. determining the type at compile-time rather than at
96 // preprocessing-time, will work for all platforms, and does not
97 // depend on ACE developer-defined configuration parameters.
99 typedef ACE::If_Then_Else
<
100 (sizeof (void*) == sizeof (signed int)),
103 (sizeof (void*) == sizeof (signed long)),
106 (sizeof (void*) == sizeof (signed long long)),
108 void /* Unknown. Force an invalid type */
111 >::result_type
intptr_t;
113 typedef ACE::If_Then_Else
<
114 (sizeof (void*) == sizeof (unsigned int)),
117 (sizeof (void*) == sizeof (unsigned long)),
120 (sizeof (void*) == sizeof (unsigned long long)),
122 void /* Unknown. Force an invalid type */
125 >::result_type
uintptr_t;
127 #endif /* ACE_LACKS_INTPTR_T */
129 // A char always has 1 byte, by definition.
130 # define ACE_SIZEOF_CHAR 1
132 // Unfortunately, there isn't a portable way to determine the size of a wchar.
133 // So we just define them on a platform basis. If the platform doesn't
134 // define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code
135 // uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid.
136 // If the platform config doesn't set this, and this guess is wrong,
137 // Basic_Types_Test should catch the inconsistency.
138 # if defined (ACE_HAS_WCHAR)
139 # if !defined (ACE_SIZEOF_WCHAR)
140 # if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
141 # define ACE_SIZEOF_WCHAR 4
143 // 0 so the Basic_Types test will catch this.
144 # define ACE_SIZEOF_WCHAR 0
145 # endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
146 # endif /* !ACE_SIZEOF_WCHAR */
147 # endif /* ACE_HAS_WCHAR */
149 // The number of bytes in a short.
150 # if !defined (ACE_SIZEOF_SHORT)
151 # if (USHRT_MAX) == 255U
152 # define ACE_SIZEOF_SHORT 1
153 # elif (USHRT_MAX) == 65535U
154 # define ACE_SIZEOF_SHORT 2
155 # elif (USHRT_MAX) == 4294967295U
156 # define ACE_SIZEOF_SHORT 4
157 # elif (USHRT_MAX) == 18446744073709551615U
158 # define ACE_SIZEOF_SHORT 8
160 # error: unsupported short size, must be updated for this platform!
161 # endif /* USHRT_MAX */
162 # endif /* !defined (ACE_SIZEOF_SHORT) */
164 // The number of bytes in an int.
165 # if !defined (ACE_SIZEOF_INT)
166 # if (UINT_MAX) == 65535U
167 # define ACE_SIZEOF_INT 2
168 # elif (UINT_MAX) == 4294967295U
169 # define ACE_SIZEOF_INT 4
170 # elif (UINT_MAX) == 18446744073709551615U
171 # define ACE_SIZEOF_INT 8
173 # error: unsupported int size, must be updated for this platform!
174 # endif /* UINT_MAX */
175 # endif /* !defined (ACE_SIZEOF_INT) */
177 // The number of bytes in a long.
178 # if !defined (ACE_SIZEOF_LONG)
179 # if (ULONG_MAX) == 65535UL
180 # define ACE_SIZEOF_LONG 2
181 # elif ((ULONG_MAX) == 4294967295UL)
182 # define ACE_SIZEOF_LONG 4
183 # elif ((ULONG_MAX) == 18446744073709551615UL)
184 # define ACE_SIZEOF_LONG 8
186 # error: unsupported long size, must be updated for this platform!
187 # endif /* ULONG_MAX */
188 # endif /* !defined (ACE_SIZEOF_LONG) */
190 // The number of bytes in a long long.
191 # if !defined (ACE_SIZEOF_LONG_LONG)
192 # if defined (ULLONG_MAX)
193 # if ((ULLONG_MAX) == 4294967295ULL)
194 # define ACE_SIZEOF_LONG_LONG 4
195 # elif ((ULLONG_MAX) == 18446744073709551615ULL)
196 # define ACE_SIZEOF_LONG_LONG 8
198 # elif defined (ULONGLONG_MAX)
199 # if ((ULONGLONG_MAX) == 4294967295ULL)
200 # define ACE_SIZEOF_LONG_LONG 4
201 # elif ((ULONGLONG_MAX) == 18446744073709551615ULL)
202 # define ACE_SIZEOF_LONG_LONG 8
205 # // If we can't determine the size of long long, assume it is 8
206 # // instead of erroring out. (Either ULLONG_MAX and ULONGLONG_MAX
207 # // may not be supported; or an extended C/C++ dialect may need to
208 # // be selected. If this assumption is wrong, it can be addressed
209 # // in the platform-specific config header.
210 # if !defined (ACE_SIZEOF_LONG_LONG)
211 # define ACE_SIZEOF_LONG_LONG 8
213 # endif /* !defined (ACE_SIZEOF_LONG_LONG) */
216 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
218 // The sizes of the commonly implemented types are now known. Set up
219 // typedefs for whatever we can. Some of these are needed for certain
220 // cases of ACE_UINT64, so do them before the 64-bit stuff.
222 #if defined (ACE_HAS_INT8_T)
223 typedef int8_t ACE_INT8
;
224 #elif defined (ACE_INT8_TYPE)
225 typedef ACE_INT8_TYPE ACE_INT8
;
226 #elif !defined (ACE_LACKS_SIGNED_CHAR)
227 typedef signed char ACE_INT8
;
229 typedef char ACE_INT8
;
230 #endif /* defined (ACE_INT8_TYPE) */
232 #if defined (ACE_HAS_UINT8_T)
233 typedef uint8_t ACE_UINT8
;
234 #elif defined (ACE_UINT8_TYPE)
235 typedef ACE_UINT8_TYPE ACE_UINT8
;
237 typedef unsigned char ACE_UINT8
;
238 #endif /* defined (ACE_UINT8_TYPE) */
240 #if defined (ACE_HAS_INT16_T)
241 typedef int16_t ACE_INT16
;
242 #elif defined (ACE_INT16_TYPE)
243 typedef ACE_INT16_TYPE ACE_INT16
;
244 #elif ACE_SIZEOF_SHORT == 2
245 typedef short ACE_INT16
;
246 #elif ACE_SIZEOF_INT == 2
247 typedef int ACE_INT16
;
249 # error Have to add to the ACE_INT16 type setting
250 #endif /* defined (ACE_INT16_TYPE) */
252 #if defined (ACE_HAS_UINT16_T)
253 typedef uint16_t ACE_UINT16
;
254 #elif defined (ACE_UINT16_TYPE)
255 typedef ACE_UINT16_TYPE ACE_UINT16
;
256 #elif ACE_SIZEOF_SHORT == 2
257 typedef unsigned short ACE_UINT16
;
258 #elif ACE_SIZEOF_INT == 2
259 typedef unsigned int ACE_UINT16
;
261 # error Have to add to the ACE_UINT16 type setting
262 #endif /* defined (ACE_UINT16_TYPE) */
264 #if defined (ACE_HAS_INT32_T)
265 typedef int32_t ACE_INT32
;
266 #elif defined (ACE_INT32_TYPE)
267 typedef ACE_INT32_TYPE ACE_INT32
;
268 #elif ACE_SIZEOF_INT == 4
269 typedef int ACE_INT32
;
270 #elif ACE_SIZEOF_LONG == 4
271 typedef long ACE_INT32
;
273 # error Have to add to the ACE_INT32 type setting
274 #endif /* defined (ACE_INT32_TYPE) */
276 #if defined (ACE_HAS_UINT32_T)
277 typedef uint32_t ACE_UINT32
;
278 #elif defined (ACE_UINT32_TYPE)
279 typedef ACE_UINT32_TYPE ACE_UINT32
;
280 #elif ACE_SIZEOF_INT == 4
281 typedef unsigned int ACE_UINT32
;
282 #elif ACE_SIZEOF_LONG == 4
283 typedef unsigned long ACE_UINT32
;
285 # error Have to add to the ACE_UINT32 type setting
286 #endif /* defined (ACE_UINT32_TYPE) */
288 #if defined (ACE_HAS_INT64_T)
289 typedef int64_t ACE_INT64
;
290 #elif defined (ACE_INT64_TYPE)
291 typedef ACE_INT64_TYPE ACE_INT64
;
292 #elif ACE_SIZEOF_LONG == 8
293 typedef long ACE_INT64
;
294 #elif ACE_SIZEOF_LONG_LONG == 8
296 // Silence g++ "-pedantic" warnings regarding use of "long long"
299 # endif /* __GNUC__ */
300 typedef long long ACE_INT64
;
301 #endif /* defined (ACE_INT64_TYPE) */
303 #if defined (ACE_HAS_UINT64_T)
304 typedef uint64_t ACE_UINT64
;
305 #elif defined (ACE_UINT64_TYPE)
306 typedef ACE_UINT64_TYPE ACE_UINT64
;
307 #elif ACE_SIZEOF_LONG == 8
308 typedef unsigned long ACE_UINT64
;
309 #elif ACE_SIZEOF_LONG_LONG == 8
311 // Silence g++ "-pedantic" warnings regarding use of "long long"
314 # endif /* __GNUC__ */
315 typedef unsigned long long ACE_UINT64
;
316 #endif /* defined (ACE_UINT64_TYPE) */
318 /// Define a generic byte for use in codecs
319 typedef unsigned char ACE_Byte
;
321 // Define a pseudo wide character type when wchar is not supported so we
322 // can support basic wide character string operations.
324 #if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
325 # define ACE_WINT_T wint_t
326 # define ACE_WCHAR_T wchar_t
328 # define ACE_WINT_T ACE_UINT16
329 # define ACE_WCHAR_T ACE_UINT16
330 #endif /* ACE_HAS_WCHAR */
332 // The number of bytes in a void *.
333 #ifndef ACE_SIZEOF_VOID_P
334 # define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
335 #endif /* ACE_SIZEOF_VOID_P */
337 ACE_END_VERSIONED_NAMESPACE_DECL
339 // Byte-order (endian-ness) determination.
340 #if defined (BYTE_ORDER)
341 # if (BYTE_ORDER == LITTLE_ENDIAN)
342 # define ACE_LITTLE_ENDIAN 0x0123
343 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
344 # elif (BYTE_ORDER == BIG_ENDIAN)
345 # define ACE_BIG_ENDIAN 0x3210
346 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
348 # error: unknown BYTE_ORDER!
349 # endif /* BYTE_ORDER */
350 #elif defined (_BYTE_ORDER)
351 # if (_BYTE_ORDER == _LITTLE_ENDIAN)
352 # define ACE_LITTLE_ENDIAN 0x0123
353 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
354 # elif (_BYTE_ORDER == _BIG_ENDIAN)
355 # define ACE_BIG_ENDIAN 0x3210
356 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
358 # error: unknown _BYTE_ORDER!
359 # endif /* _BYTE_ORDER */
360 #elif defined (__BYTE_ORDER)
361 # if (__BYTE_ORDER == __LITTLE_ENDIAN)
362 # define ACE_LITTLE_ENDIAN 0x0123
363 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
364 # elif (__BYTE_ORDER == __BIG_ENDIAN)
365 # define ACE_BIG_ENDIAN 0x3210
366 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
368 # error: unknown __BYTE_ORDER!
369 # endif /* __BYTE_ORDER */
370 #else /* ! BYTE_ORDER && ! __BYTE_ORDER */
371 // We weren't explicitly told, so we have to figure it out . . .
372 // Note that Itanium hardware (IA64) can run in either byte order. It's
373 // selected by the OS when loading; Windows runs little, HP-UX runs big.
374 # if defined (i386) || defined (__i386__) || defined (_M_IX86) || \
375 defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) || \
376 defined (ARM) || defined (_M_IA64) || defined (_M_AMD64) || \
377 defined (__amd64) || \
378 ((defined (__ia64__) || defined (__ia64)) && !defined (__hpux))
379 // We know these are little endian.
380 # define ACE_LITTLE_ENDIAN 0x0123
381 # define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
383 // Otherwise, we assume big endian.
384 # define ACE_BIG_ENDIAN 0x3210
385 # define ACE_BYTE_ORDER ACE_BIG_ENDIAN
387 #endif /* ! BYTE_ORDER && ! __BYTE_ORDER */
389 // Byte swapping macros to deal with differences between little endian
390 // and big endian machines. Note that "long" here refers to 32 bit
392 # define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
393 | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
394 # define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8))
396 # define ACE_HTONL(X) htonl (X)
397 # define ACE_NTOHL(X) ntohl (X)
399 # if defined (ACE_LITTLE_ENDIAN)
400 # define ACE_IDL_NCTOHL(X) (X)
401 # define ACE_IDL_NSTOHL(X) (X)
403 # define ACE_IDL_NCTOHL(X) (X << 24)
404 # define ACE_IDL_NSTOHL(X) ((X) << 16)
405 # endif /* ACE_LITTLE_ENDIAN */
407 // MQX doesn't define these macros correctly.
408 # if defined (ACE_LITTLE_ENDIAN) && defined (ACE_MQX)
409 # define ACE_HTONS(x) x
410 # define ACE_NTOHS(x) x
412 # define ACE_HTONS(x) htons(x)
413 # define ACE_NTOHS(x) ntohs(x)
416 # define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
417 reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L))
419 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
422 ACE_U64_TO_U32 (ACE_UINT64 n
)
424 return static_cast<ACE_UINT32
> (n
);
428 ACE_CU64_TO_CU32 (ACE_UINT64 n
)
430 return static_cast<ACE_UINT32
> (n
);
433 ACE_END_VERSIONED_NAMESPACE_DECL
435 #if defined (ACE_WIN32)
436 # if defined (__MINGW32__)
437 # define ACE_UINT64_LITERAL(n) n ## ull
438 # define ACE_INT64_LITERAL(n) n ## ll
440 # define ACE_UINT64_LITERAL(n) n ## ui64
441 # define ACE_INT64_LITERAL(n) n ## i64
442 # endif /* defined (__MINGW32__) */
443 #else /* ! ACE_WIN32 */
444 # define ACE_UINT64_LITERAL(n) n ## ull
445 # define ACE_INT64_LITERAL(n) n ## ll
446 #endif /* ! ACE_WIN32*/
448 #if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII)
450 # define ACE_INT8_FORMAT_SPECIFIER_ASCII "%" PRId8
452 # define ACE_INT8_FORMAT_SPECIFIER_ASCII "%d"
453 # endif /* defined (PRId8) */
454 #endif /* ACE_INT8_FORMAT_SPECIFIER_ASCII */
456 #if !defined (ACE_INT8_FORMAT_SPECIFIER)
458 # define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8)
460 # define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT (ACE_INT8_FORMAT_SPECIFIER_ASCII)
461 # endif /* defined (PRId8) */
462 #endif /* ACE_INT8_FORMAT_SPECIFIER */
464 #if !defined (ACE_UINT8_FORMAT_SPECIFIER_ASCII)
466 # define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%" PRIu8
468 # define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%u"
469 # endif /* defined (PRIu8) */
470 #endif /* ACE_UINT8_FORMAT_SPECIFIER */
472 #if !defined (ACE_UINT8_FORMAT_SPECIFIER)
474 # define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8)
476 # define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT8_FORMAT_SPECIFIER_ASCII)
477 # endif /* defined (PRIu8) */
478 #endif /* ACE_UINT8_FORMAT_SPECIFIER */
480 #if !defined (ACE_INT16_FORMAT_SPECIFIER_ASCII)
481 # if defined (PRId16)
482 # define ACE_INT16_FORMAT_SPECIFIER_ASCII "%" PRId16
484 # define ACE_INT16_FORMAT_SPECIFIER_ASCII "%d"
485 # endif /* defined (PRId16) */
486 #endif /* ACE_INT16_FORMAT_SPECIFIER */
488 #if !defined (ACE_INT16_FORMAT_SPECIFIER)
489 # if defined (PRId16)
490 # define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16)
492 # define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT (ACE_INT16_FORMAT_SPECIFIER_ASCII)
493 # endif /* defined (PRId16) */
494 #endif /* ACE_INT16_FORMAT_SPECIFIER */
496 #if !defined (ACE_UINT16_FORMAT_SPECIFIER_ASCII)
497 # if defined (PRIu16)
498 # define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%" PRIu16
500 # define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%u"
501 # endif /* defined (PRIu16) */
502 #endif /* ACE_UINT16_FORMAT_SPECIFIER */
504 #if !defined (ACE_UINT16_FORMAT_SPECIFIER)
505 # if defined (PRIu16)
506 # define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16)
508 # define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT16_FORMAT_SPECIFIER_ASCII)
509 # endif /* defined (PRIu16) */
510 #endif /* ACE_UINT16_FORMAT_SPECIFIER */
512 #if !defined (ACE_INT32_FORMAT_SPECIFIER_ASCII)
513 # if defined (PRId32)
514 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%" PRId32
515 # elif ACE_SIZEOF_INT == 4
516 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%d"
518 # define ACE_INT32_FORMAT_SPECIFIER_ASCII "%ld"
519 # endif /* defined (PRId32) */
520 #endif /* ACE_INT32_FORMAT_SPECIFIER */
522 #if !defined (ACE_INT32_FORMAT_SPECIFIER)
523 # if defined (PRId32)
524 # define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32)
526 # define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT (ACE_INT32_FORMAT_SPECIFIER_ASCII)
527 # endif /* defined (PRId32) */
528 #endif /* ACE_INT32_FORMAT_SPECIFIER */
530 #if !defined (ACE_UINT32_FORMAT_SPECIFIER_ASCII)
531 # if defined (PRIu32)
532 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%" PRIu32
533 # elif ACE_SIZEOF_INT == 4
534 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%u"
536 # define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%lu"
537 # endif /* defined (PRIu32) */
538 #endif /* ACE_UINT32_FORMAT_SPECIFIER */
540 #if !defined (ACE_UINT32_FORMAT_SPECIFIER)
541 # if defined (PRIu32)
542 # define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32)
544 # define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT32_FORMAT_SPECIFIER_ASCII)
545 # endif /* defined (PRIu32) */
546 #endif /* ACE_UINT32_FORMAT_SPECIFIER */
548 #if !defined (ACE_INT64_FORMAT_SPECIFIER_ASCII)
549 # if defined (PRId64)
550 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%" PRId64
551 # elif ACE_SIZEOF_LONG == 8
552 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%ld"
554 # define ACE_INT64_FORMAT_SPECIFIER_ASCII "%lld"
555 # endif /* defined (PRId64) */
556 #endif /* ACE_INT64_FORMAT_SPECIFIER */
558 #if !defined (ACE_INT64_FORMAT_SPECIFIER)
559 # if defined (PRId64)
560 # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64)
562 # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT (ACE_INT64_FORMAT_SPECIFIER_ASCII)
563 # endif /* defined (PRId64) */
564 #endif /* ACE_INT64_FORMAT_SPECIFIER */
566 #if !defined (ACE_UINT64_FORMAT_SPECIFIER_ASCII)
567 # if defined (PRIu64)
568 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%" PRIu64
569 # elif ACE_SIZEOF_LONG == 8
570 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu"
572 # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%llu"
573 # endif /* defined (PRIu64) */
574 #endif /* ACE_UINT64_FORMAT_SPECIFIER_ASCII */
576 #if !defined (ACE_UINT64_FORMAT_SPECIFIER)
577 # if defined (PRIu64)
578 # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64)
580 # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT64_FORMAT_SPECIFIER_ASCII)
581 # endif /* defined (PRIu64) */
582 #endif /* ACE_UINT64_FORMAT_SPECIFIER */
584 #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII)
585 # if defined (ACE_WIN64)
586 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d"
587 # elif defined (_WRS_CONFIG_LP64)
588 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld"
590 # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d"
591 # endif /* ACE_WIN64 */
592 #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
594 #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
595 #define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII)
596 #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
598 #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII)
599 # if defined (ACE_WIN64)
600 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u"
601 # elif defined (_WRS_CONFIG_LP64)
602 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu"
604 # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u"
605 # endif /* ACE_WIN64 */
606 #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
608 #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
609 #define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII)
610 #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
612 // Cast from UINT64 to a double requires an intermediate cast to INT64
613 // on some platforms.
614 #if defined (ACE_WIN32)
615 # define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n)
616 #else /* ! ACE_WIN32 && */
617 # define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
618 #endif /* ! ACE_WIN32 && */
621 // The number of bytes in a float.
622 # ifndef ACE_SIZEOF_FLOAT
623 # if FLT_MAX_EXP == 128
624 # define ACE_SIZEOF_FLOAT 4
625 # elif FLT_MAX_EXP == 1024
626 # define ACE_SIZEOF_FLOAT 8
628 # error: unsupported float size, must be updated for this platform!
629 # endif /* FLT_MAX_EXP */
630 # endif /* ACE_SIZEOF_FLOAT */
632 // The number of bytes in a double.
633 # ifndef ACE_SIZEOF_DOUBLE
634 # if DBL_MAX_EXP == 128
635 # define ACE_SIZEOF_DOUBLE 4
636 # elif DBL_MAX_EXP == 1024
637 # define ACE_SIZEOF_DOUBLE 8
639 # error: unsupported double size, must be updated for this platform!
640 # endif /* DBL_MAX_EXP */
641 # endif /* ACE_SIZEOF_DOUBLE */
643 // The number of bytes in a long double.
644 # ifndef ACE_SIZEOF_LONG_DOUBLE
645 # if LDBL_MAX_EXP == 128
646 # define ACE_SIZEOF_LONG_DOUBLE 4
647 # elif LDBL_MAX_EXP == 1024
648 # if defined (__powerpc64__)
649 # define ACE_SIZEOF_LONG_DOUBLE 16
651 # define ACE_SIZEOF_LONG_DOUBLE 8
653 # elif LDBL_MAX_EXP == 16384
654 # if defined (LDBL_DIG) && LDBL_DIG == 18
655 # if defined (__ia64) || defined (__x86_64)
656 # define ACE_SIZEOF_LONG_DOUBLE 16
657 # else /* ! __ia64 || __x86_64 */
658 # define ACE_SIZEOF_LONG_DOUBLE 12
660 # else /* ! LDBL_DIG || LDBL_DIG != 18 */
661 # define ACE_SIZEOF_LONG_DOUBLE 16
662 # endif /* ! LDBL_DIG || LDBL_DIG != 18 */
664 # error: unsupported double size, must be updated for this platform!
665 # endif /* LDBL_MAX_EXP */
666 # endif /* ACE_SIZEOF_LONG_DOUBLE */
668 // Max and min sizes for the ACE integer types.
669 #define ACE_INT8_MAX 0x7F
670 #define ACE_INT8_MIN -(ACE_INT8_MAX) - 1
671 #define ACE_UINT8_MAX 0xFF
672 #define ACE_CHAR_MAX (ACE_INT8_MAX)
673 #define ACE_CHAR_MIN (ACE_INT8_MIN)
674 #define ACE_OCTET_MAX (ACE_UINT8_MAX)
675 #define ACE_INT16_MAX 0x7FFF
676 #define ACE_INT16_MIN -(ACE_INT16_MAX) - 1
677 #define ACE_UINT16_MAX 0xFFFF
678 #define ACE_WCHAR_MAX ACE_UINT16_MAX
679 #define ACE_INT32_MAX 0x7FFFFFFF
680 #define ACE_INT32_MIN -(ACE_INT32_MAX) - 1
681 #define ACE_UINT32_MAX 0xFFFFFFFF
682 #define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
683 #define ACE_INT64_MIN -(ACE_INT64_MAX) - 1
684 #define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
686 // These use ANSI/IEEE format.
687 #define ACE_FLT_MAX 3.402823466e+38F
688 #define ACE_FLT_MIN 1.175494351e-38F
689 #define ACE_FLT_LOWEST -(ACE_FLT_MAX)
690 #define ACE_DBL_MAX 1.7976931348623158e+308
691 #define ACE_DBL_MIN 2.2250738585072014e-308
692 #define ACE_DBL_LOWEST -(ACE_DBL_MAX)
694 # include /**/ "ace/post.h"
695 #endif /* ACE_BASIC_TYPES_H */