summaryrefslogtreecommitdiff
path: root/ace/Basic_Types.h
blob: c3ee616356e6c68105658ab8f488de3410d2dc31 (plain)
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Basic_Types.h
 *
 *  $Id$
 *
 *  @author David L. Levine
 *
 *  #defines the list of preprocessor macros below.  The config.h file can
 *  pre-define any of these to short-cut the definitions.  This is usually
 *  only necessary if the preprocessor does all of its math using integers.
 *
 *  Sizes of built-in types:
 *    - ACE_SIZEOF_CHAR
 *    - ACE_SIZEOF_SHORT
 *    - ACE_SIZEOF_INT
 *    - ACE_SIZEOF_LONG
 *    - ACE_SIZEOF_LONG_LONG
 *    - ACE_SIZEOF_VOID_P
 *    - ACE_SIZEOF_FLOAT
 *    - ACE_SIZEOF_DOUBLE
 *    - ACE_SIZEOF_LONG_DOUBLE
 *
 *  Wrappers for built-in types of specific sizes:
 *    - ACE_USHORT16 (For backward compatibility.  Use ACE_UINT16 instead.)
 *    - ACE_INT8
 *    - ACE_UINT8
 *    - ACE_INT16
 *    - ACE_UINT16
 *    - ACE_INT32
 *    - ACE_UINT32
 *    - ACE_UINT64
 *  (@note ACE_INT64 is partly defined, there is no ACE_LongLong for
 *   platforms that don't have a native 8-byte integer type.)
 *
 *  Byte-order (endian-ness) determination:
 *    ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN
 *
 *
 */
//=============================================================================

#include "ace/config-lite.h"

#ifndef ACE_BASIC_TYPES_H
# define ACE_BASIC_TYPES_H

# include /**/ "ace/pre.h"

# if !defined (ACE_LACKS_PRAGMA_ONCE)
#   pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */

// Pull in definitions
# include "ace/os_include/os_limits.h"   // Integer limits
# include "ace/os_include/os_float.h"    // Floating point limits
# include "ace/os_include/os_stdlib.h"   // Other types
# include "ace/os_include/os_stddef.h"   // Get ptrdiff_t - see further comments below

# if defined(ACE_LACKS_LONGLONG_T)
#   include "ace/os_include/os_stdarg.h" // LynxOS requires this before stdio.h
#   include "ace/os_include/os_stdio.h"  // For long long emulation
# endif  /* ACE_LACKS_LONGLONG_T */

# include "ace/os_include/sys/os_types.h"

# if !defined (ACE_LACKS_SYS_PARAM_H)
#  include /**/ <sys/param.h>
# endif /* ACE_LACKS_SYS_PARAM_H */

# include "ace/ACE_export.h"

# if !defined (ACE_LACKS_STDINT_H)
#  include <stdint.h>
# endif
# if !defined (ACE_LACKS_INTTYPES_H)
#  include <inttypes.h>
# endif

// A char always has 1 byte, by definition.
# define ACE_SIZEOF_CHAR 1

// The number of bytes in a short.
# if !defined (ACE_SIZEOF_SHORT)
#   if (USHRT_MAX) == 255U
#     define ACE_SIZEOF_SHORT 1
#   elif (USHRT_MAX) == 65535U
#     define ACE_SIZEOF_SHORT 2
#   elif (USHRT_MAX) == 4294967295U
#     define ACE_SIZEOF_SHORT 4
#   elif (USHRT_MAX) == 18446744073709551615U
#     define ACE_SIZEOF_SHORT 8
#   else
#     error: unsupported short size, must be updated for this platform!
#   endif /* USHRT_MAX */
# endif /* !defined (ACE_SIZEOF_SHORT) */

// The number of bytes in an int.
# if !defined (ACE_SIZEOF_INT)
#   if (UINT_MAX) == 65535U
#     define ACE_SIZEOF_INT 2
#   elif (UINT_MAX) == 4294967295U
#     define ACE_SIZEOF_INT 4
#   elif (UINT_MAX) == 18446744073709551615U
#     define ACE_SIZEOF_INT 8
#   else
#     error: unsupported int size, must be updated for this platform!
#   endif /* UINT_MAX */
# endif /* !defined (ACE_SIZEOF_INT) */

// The number of bytes in a long.
# if !defined (ACE_SIZEOF_LONG)
#   if (ULONG_MAX) == 65535UL
#     define ACE_SIZEOF_LONG 2
#   elif ((ULONG_MAX) == 4294967295UL)
#     define ACE_SIZEOF_LONG 4
#   elif ((ULONG_MAX) == 18446744073709551615UL)
#     define ACE_SIZEOF_LONG 8
#   else
#     error: unsupported long size, must be updated for this platform!
#   endif /* ULONG_MAX */
# endif /* !defined (ACE_SIZEOF_LONG) */

// The number of bytes in a long long.
# if !defined (ACE_SIZEOF_LONG_LONG)
#   if defined (ACE_LACKS_LONGLONG_T)
#     define ACE_SIZEOF_LONG_LONG 8
#   elif defined (ULLONG_MAX)
#     if ((ULLONG_MAX) == 4294967295ULL)
#       define ACE_SIZEOF_LONG_LONG 4
#     elif ((ULLONG_MAX) == 18446744073709551615ULL)
#       define ACE_SIZEOF_LONG_LONG 8
#     endif
#   elif defined (ULONGLONG_MAX)
#     if ((ULONGLONG_MAX) == 4294967295ULL)
#       define ACE_SIZEOF_LONG_LONG 4
#     elif ((ULONGLONG_MAX) == 18446744073709551615ULL)
#       define ACE_SIZEOF_LONG_LONG 8
#     endif
#   endif
#   // If we can't determine the size of long long, assume it is 8
#   // instead of erroring out.  (Either ULLONG_MAX and ULONGLONG_MAX
#   // may not be supported; or an extended C/C++ dialect may need to
#   // be selected.  If this assumption is wrong, it can be addressed
#   // in the platform-specific config header.
#   if !defined (ACE_SIZEOF_LONG_LONG)
#     define ACE_SIZEOF_LONG_LONG 8
#   endif
# endif /* !defined (ACE_SIZEOF_LONG_LONG) */


ACE_BEGIN_VERSIONED_NAMESPACE_DECL

// The sizes of the commonly implemented types are now known.  Set up
// typedefs for whatever we can.  Some of these are needed for certain
// cases of ACE_UINT64, so do them before the 64-bit stuff.

#if defined (ACE_INT8_TYPE)
  typedef ACE_INT8_TYPE         ACE_INT8;
#elif defined (ACE_HAS_INT8_T)
  typedef int8_t                ACE_INT8;
#elif !defined (ACE_LACKS_SIGNED_CHAR)
  typedef signed char           ACE_INT8;
#else
  typedef char                  ACE_INT8;
#endif /* defined (ACE_INT8_TYPE) */

#if defined (ACE_UINT8_TYPE)
  typedef ACE_UINT8_TYPE        ACE_UINT8;
#elif defined (ACE_HAS_UINT8_T)
  typedef uint8_t               ACE_UINT8;
#else
  typedef unsigned char         ACE_UINT8;
#endif /* defined (ACE_UINT8_TYPE) */

#if defined (ACE_INT16_TYPE)
  typedef ACE_INT16_TYPE        ACE_INT16;
#elif defined (ACE_HAS_INT16_T)
  typedef int16_t               ACE_INT16;
#elif ACE_SIZEOF_SHORT == 2
  typedef short                 ACE_INT16;
#elif ACE_SIZEOF_INT == 2
  typedef int                   ACE_INT16;
#else
# error Have to add to the ACE_INT16 type setting
#endif  /* defined (ACE_INT16_TYPE) */

#if defined (ACE_UINT16_TYPE)
  typedef ACE_UINT16_TYPE       ACE_UINT16;
#elif defined (ACE_HAS_UINT16_T)
  typedef uint16_t              ACE_UINT16;
#elif ACE_SIZEOF_SHORT == 2
  typedef unsigned short        ACE_UINT16;
#elif ACE_SIZEOF_INT == 2
  typedef unsigned int          ACE_UINT16;
#else
# error Have to add to the ACE_UINT16 type setting
#endif /* defined (ACE_UINT16_TYPE) */

#if defined (ACE_INT32_TYPE)
  typedef ACE_INT32_TYPE        ACE_INT32;
#elif defined (ACE_HAS_INT32_T)
  typedef int32_t               ACE_INT32;
#elif ACE_SIZEOF_INT == 4
  typedef int                   ACE_INT32;
#elif ACE_SIZEOF_LONG == 4
  typedef long                  ACE_INT32;
#else
# error Have to add to the ACE_INT32 type setting
#endif /* defined (ACE_INT32_TYPE) */

#if defined (ACE_UINT32_TYPE)
  typedef ACE_UINT32_TYPE       ACE_UINT32;
#elif defined (ACE_HAS_UINT32_T)
  typedef uint32_t              ACE_UINT32;
#elif ACE_SIZEOF_INT == 4
  typedef unsigned int          ACE_UINT32;
#elif ACE_SIZEOF_LONG == 4
  typedef unsigned long         ACE_UINT32;
#else
# error Have to add to the ACE_UINT32 type setting
#endif /* defined (ACE_UINT32_TYPE) */

#if defined (ACE_INT64_TYPE)
  typedef ACE_INT64_TYPE        ACE_INT64;
#elif defined (ACE_HAS_INT64_T)
  typedef int64_t               ACE_INT64;
#elif ACE_SIZEOF_LONG == 8
  typedef long                  ACE_INT64;
#elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8
  typedef long long             ACE_INT64;
#endif /* defined (ACE_INT64_TYPE) */

#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T))
/* See matching #if around ACE_U_LongLong class declaration below */

#  if defined (ACE_UINT64_TYPE)
  typedef ACE_UINT64_TYPE       ACE_UINT64;
#  elif defined (ACE_HAS_UINT64_T)
  typedef uint64_t              ACE_UINT64;
#  elif ACE_SIZEOF_LONG == 8
  typedef unsigned long         ACE_UINT64;
#  elif ACE_SIZEOF_LONG_LONG == 8
  typedef unsigned long long    ACE_UINT64;
#  endif /* defined (ACE_UINT64_TYPE) */
#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */


typedef ACE_UINT16 ACE_USHORT16;  // @@ Backward compatibility.

// Define a generic byte for use in codecs
typedef unsigned char ACE_Byte;

// The number of bytes in a void *.
# ifndef ACE_SIZEOF_VOID_P
#   define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
# endif /* ACE_SIZEOF_VOID_P */

// Type for doing arithmetic on pointers ... as elsewhere, we assume
// that unsigned versions of a type are the same size as the signed
// version of the same type.
# if defined (ACE_HAS_WINCE) && (_WIN32_WCE < 400)
typedef unsigned long ptrdiff_t;    // evc3, PocketPC don't defined ptrdiff_t
# endif

ACE_END_VERSIONED_NAMESPACE_DECL

// Byte-order (endian-ness) determination.
# if defined (BYTE_ORDER)
#   if (BYTE_ORDER == LITTLE_ENDIAN)
#     define ACE_LITTLE_ENDIAN 0x0123
#     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
#   elif (BYTE_ORDER == BIG_ENDIAN)
#     define ACE_BIG_ENDIAN 0x3210
#     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
#   else
#     error: unknown BYTE_ORDER!
#   endif /* BYTE_ORDER */
# elif defined (_BYTE_ORDER)
#   if (_BYTE_ORDER == _LITTLE_ENDIAN)
#     define ACE_LITTLE_ENDIAN 0x0123
#     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
#   elif (_BYTE_ORDER == _BIG_ENDIAN)
#     define ACE_BIG_ENDIAN 0x3210
#     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
#   else
#     error: unknown _BYTE_ORDER!
#   endif /* _BYTE_ORDER */
# elif defined (__BYTE_ORDER)
#   if (__BYTE_ORDER == __LITTLE_ENDIAN)
#     define ACE_LITTLE_ENDIAN 0x0123
#     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
#   elif (__BYTE_ORDER == __BIG_ENDIAN)
#     define ACE_BIG_ENDIAN 0x3210
#     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
#   else
#     error: unknown __BYTE_ORDER!
#   endif /* __BYTE_ORDER */
# else /* ! BYTE_ORDER && ! __BYTE_ORDER */
  // We weren't explicitly told, so we have to figure it out . . .
#   if defined (i386) || defined (__i386__) || defined (_M_IX86) || \
     defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) ||\
     defined (ARM) || defined (_M_IA64) || \
     defined (_M_AMD64) || defined (__amd64)
    // We know these are little endian.
#     define ACE_LITTLE_ENDIAN 0x0123
#     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
#   else
    // Otherwise, we assume big endian.
#     define ACE_BIG_ENDIAN 0x3210
#     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
#   endif
# endif /* ! BYTE_ORDER && ! __BYTE_ORDER */

// Byte swapping macros to deal with differences between little endian
// and big endian machines.  Note that "long" here refers to 32 bit
// quantities.
# define ACE_SWAP_LONG(L) ((ACE_SWAP_WORD ((L) & 0xFFFF) << 16) \
            | ACE_SWAP_WORD(((L) >> 16) & 0xFFFF))
# define ACE_SWAP_WORD(L) ((((L) & 0x00FF) << 8) | (((L) & 0xFF00) >> 8))

# if defined (ACE_LITTLE_ENDIAN)
#   define ACE_HTONL(X) ACE_SWAP_LONG (X)
#   define ACE_NTOHL(X) ACE_SWAP_LONG (X)
#   define ACE_IDL_NCTOHL(X) (X)
#   define ACE_IDL_NSTOHL(X) (X)
# else
#   define ACE_HTONL(X) X
#   define ACE_NTOHL(X) X
#   define ACE_IDL_NCTOHL(X) (X << 24)
#   define ACE_IDL_NSTOHL(X) ((X) << 16)
# endif /* ACE_LITTLE_ENDIAN */

# if defined (ACE_LITTLE_ENDIAN)
#   define ACE_HTONS(x) ACE_SWAP_WORD(x)
#   define ACE_NTOHS(x) ACE_SWAP_WORD(x)
# else
#   define ACE_HTONS(x) x
#   define ACE_NTOHS(x) x
# endif /* ACE_LITTLE_ENDIAN */

#if defined (ACE_LACKS_LONGLONG_T)
  // This throws away the high 32 bits.  It's very unlikely that a
  // pointer will be more than 32 bits wide if the platform does not
  // support 64-bit integers.
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
  reinterpret_cast<PTR_TYPE> (L.lo ())
#else  /* ! ACE_LACKS_LONGLONG_T */
# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
  reinterpret_cast<PTR_TYPE> (static_cast<ptrdiff_t> (L))
#endif /* ! ACE_LACKS_LONGLONG_T */

// If the platform lacks an unsigned long long, define one.
#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
// Forward declaration for streams
#   include "ace/iosfwd.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class ACE_U_LongLong
 *
 * @brief Unsigned long long for platforms that don't have one.
 *
 * Provide our own unsigned long long.  This is intended to be
 * use with ACE_High_Res_Timer, so the division operator assumes
 * that the quotient fits into a u_long.
 * Please note that the constructor takes (optionally) two values.
 * The high one contributes 0x100000000 times its value.  So,
 * for example, (0, 2) is _not_ 20000000000, but instead
 * 0x200000000.  To emphasize this, the default values are expressed
 * in hex, and output () dumps the value in hex.
 */
  class ACE_Export ACE_U_LongLong
  {
  public:
    // = Initialization and termination methods.
#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
    ACE_U_LongLong (const long long value = 0x0);
#else
    ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0);
#endif
    ACE_U_LongLong (const ACE_U_LongLong &);
    ACE_U_LongLong &operator= (const ACE_U_LongLong &);
    ACE_U_LongLong &operator= (const ACE_INT32 &);
    ACE_U_LongLong &operator= (const ACE_UINT32 &);
    ~ACE_U_LongLong (void);

    // = Overloaded relation operators.
    bool operator== (const ACE_U_LongLong &) const;
    bool operator== (const ACE_UINT32) const;
    bool operator!= (const ACE_U_LongLong &) const;
    bool operator!= (const ACE_UINT32) const;
    bool operator< (const ACE_U_LongLong &) const;
    bool operator< (const ACE_UINT32) const;
    bool operator<= (const ACE_U_LongLong &) const;
    bool operator<= (const ACE_UINT32) const;
    bool operator> (const ACE_U_LongLong &) const;
    bool operator> (const ACE_UINT32) const;
    bool operator>= (const ACE_U_LongLong &) const;
    bool operator>= (const ACE_UINT32) const;

    ACE_U_LongLong operator+ (const ACE_U_LongLong &) const;
    ACE_U_LongLong operator+ (const ACE_UINT32) const;
    ACE_U_LongLong operator- (const ACE_U_LongLong &) const;
    ACE_U_LongLong operator- (const ACE_UINT32) const;
    ACE_U_LongLong operator* (const ACE_UINT32) const;
    ACE_U_LongLong &operator*= (const ACE_UINT32);

    ACE_U_LongLong operator<< (const unsigned int) const;
    ACE_U_LongLong &operator<<= (const unsigned int);
    ACE_U_LongLong operator>> (const unsigned int) const;
    ACE_U_LongLong &operator>>= (const unsigned int);

    double operator/ (const double) const;

    ACE_U_LongLong &operator+= (const ACE_U_LongLong &);
    ACE_U_LongLong &operator+= (const ACE_UINT32);
    ACE_U_LongLong &operator-= (const ACE_U_LongLong &);
    ACE_U_LongLong &operator-= (const ACE_UINT32);
    ACE_U_LongLong &operator++ ();
    ACE_U_LongLong &operator-- ();
    const ACE_U_LongLong operator++ (int);
    const ACE_U_LongLong operator-- (int);
    ACE_U_LongLong &operator|= (const ACE_U_LongLong);
    ACE_U_LongLong &operator|= (const ACE_UINT32);
    ACE_U_LongLong &operator&= (const ACE_U_LongLong);
    ACE_U_LongLong &operator&= (const ACE_UINT32);

    // Note that the following take ACE_UINT32 arguments.  These are
    // typical use cases, and easy to implement.  But, they limit the
    // return values to 32 bits as well.  There are no checks for
    // overflow.
    ACE_UINT32 operator/ (const ACE_UINT32) const;
    ACE_UINT32 operator% (const ACE_UINT32) const;

    // The following only operate on the lower 32 bits (they take only
    // 32 bit arguments).
    ACE_UINT32 operator| (const ACE_INT32) const;
    ACE_UINT32 operator& (const ACE_INT32) const;

    // The following operators convert their arguments to
    // ACE_UINT32.  So, there may be information loss if they are
    // used.
    ACE_U_LongLong operator* (const ACE_INT32) const;
    ACE_U_LongLong &operator*= (const ACE_INT32);
    ACE_UINT32 operator/ (const ACE_INT32) const;
#   if ACE_SIZEOF_INT == 4
    ACE_UINT32 operator/ (const unsigned long) const;
    ACE_UINT32 operator/ (const long) const;
#   else  /* ACE_SIZEOF_INT != 4 */
    ACE_UINT32 operator/ (const unsigned int) const;
    ACE_UINT32 operator/ (const int) const;
#   endif /* ACE_SIZEOF_INT != 4 */

    // = Helper methods.
    /// Outputs the value to the FILE, in hex.
    void output (FILE * = stdout) const;

    ACE_TCHAR *as_string (ACE_TCHAR *string,
                          unsigned int base = 10,
                          unsigned int uppercase = 0) const;

    ACE_UINT32 hi (void) const;
    ACE_UINT32 lo (void) const;

    void hi (const ACE_UINT32 hi);
    void lo (const ACE_UINT32 lo);

#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
    long long to_int64 (void) const;
#   endif

  private:

#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
    long long data_;
#else
  public:
    struct ace_hi_lo_correct_endian
    {
#  if defined (ACE_BIG_ENDIAN)
      /// High 32 bits.
      ACE_UINT32 hi_;
      /// Low 32 bits.
      ACE_UINT32 lo_;

#  else

      /// Low 32 bits.
      ACE_UINT32 lo_;
      /// High 32 bits.
      ACE_UINT32 hi_;
#  endif /* ! ACE_BIG_ENDIAN */
    };
  private:
    union
    {
      struct ace_hi_lo_correct_endian data_;

      /// To ensure alignment on 8-byte boundary.
      /**
       * @note "double" isn't usually usable with
       *       ACE_LACKS_FLOATING_POINT, but this seems OK.
       */
      double for_alignment_;
    };

    // @note  the following four accessors are inlined here in
    // order to minimize the extent of the data_ struct.  It's
    // only used here; the .i and .cpp files use the accessors.

    /// Internal utility function to hide access through struct.
    const ACE_UINT32 &h_ () const { return data_.hi_; }

    /// Internal utility function to hide access through struct.
    ACE_UINT32 &h_ () { return data_.hi_; }

    /// Internal utility function to hide access through struct.
    const ACE_UINT32 &l_ () const { return data_.lo_; }

    /// Internal utility function to hide access through struct.
    ACE_UINT32 &l_ () { return data_.lo_; }

    // @note  the above four accessors are inlined here in
    // order to minimize the extent of the data_ struct.  It's
    // only used here; the .i and .cpp files use the accessors.

    /// These functions are used to implement multiplication.
    ACE_UINT32 ul_shift (ACE_UINT32 a,
                         ACE_UINT32 c_in,
                         ACE_UINT32 *c_out) const;
    ACE_U_LongLong ull_shift (ACE_U_LongLong a,
                              ACE_UINT32 c_in,
                              ACE_UINT32 *c_out) const;
    ACE_U_LongLong ull_add (ACE_U_LongLong a,
                            ACE_U_LongLong b,
                            ACE_UINT32 *carry) const;
    ACE_U_LongLong ull_mult (ACE_U_LongLong a,
                             ACE_UINT32 b,
                             ACE_UINT32 *carry) const;
#endif // ACE_LACKS_UNSIGNEDLONGLONG_T
  };

  typedef ACE_U_LongLong ACE_UINT64;

#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
  ostream &operator<< (ostream &, const ACE_U_LongLong &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */

ACE_END_VERSIONED_NAMESPACE_DECL

# endif /* ACE_LACKS_LONGLONG_T */

// Conversions from ACE_UINT64 to ACE_UINT32.  ACE_CU64_TO_CU32 should
// be used on const ACE_UINT64's.
# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
#   define ACE_U64_TO_U32(n) ((n).lo ())
#   define ACE_CU64_TO_CU32(n) ((n).lo ())
# else  /* ! ACE_LACKS_LONGLONG_T */
#   define ACE_U64_TO_U32(n) (static_cast<ACE_UINT32> (n))
#   define ACE_CU64_TO_CU32(n) \
     (static_cast<ACE_CAST_CONST ACE_UINT32> (n))
# endif /* ! ACE_LACKS_LONGLONG_T */

// 64-bit literals require special marking on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
    // Can only specify 32-bit arguments.
#   define ACE_UINT64_LITERAL(n) n ## UL
      // This one won't really work, but it'll keep
      // some compilers happy until we have better support
#   define ACE_INT64_LITERAL(n) n ## L
# elif defined (ACE_WIN32)
#  if defined (__IBMCPP__) && (__IBMCPP__ >= 400)
#   define ACE_UINT64_LITERAL(n) n ## LL
#   define ACE_INT64_LITERAL(n) n ## LL
#  elif defined (__MINGW32__)
#   define ACE_UINT64_LITERAL(n) n ## ull
#   define ACE_INT64_LITERAL(n) n ## ll
#  else
#   define ACE_UINT64_LITERAL(n) n ## ui64
#   define ACE_INT64_LITERAL(n) n ## i64
#  endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) */
# elif defined (__TANDEM)
#   define ACE_UINT64_LITERAL(n) n ## LL
#   define ACE_INT64_LITERAL(n) n ## LL
# else  /* ! ACE_WIN32  &&  ! ACE_LACKS_LONGLONG_T */
#   define ACE_UINT64_LITERAL(n) n ## ull
#   define ACE_INT64_LITERAL(n) n ## ll
# endif /* ! ACE_WIN32  &&  ! ACE_LACKS_LONGLONG_T */

#if !defined (ACE_INT8_FORMAT_SPECIFIER)
#  if defined (PRId8)
#    define ACE_INT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId8)
#  else
#    define ACE_INT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d")
#  endif /* defined (PRId8) */
#endif /* ACE_INT8_FORMAT_SPECIFIER */

#if !defined (ACE_UINT8_FORMAT_SPECIFIER)
#  if defined (PRIu8)
#    define ACE_UINT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu8)
#  else
#    define ACE_UINT8_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u")
#  endif /* defined (PRIu8) */
#endif /* ACE_UINT8_FORMAT_SPECIFIER */

#if !defined (ACE_INT16_FORMAT_SPECIFIER)
#  if defined (PRId16)
#    define ACE_INT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId16)
#  else
#    define ACE_INT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d")
#  endif /* defined (PRId16) */
#endif /* ACE_INT16_FORMAT_SPECIFIER */

#if !defined (ACE_UINT16_FORMAT_SPECIFIER)
#  if defined (PRIu16)
#    define ACE_UINT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu16)
#  else
#    define ACE_UINT16_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u")
#  endif /* defined (PRIu16) */
#endif /* ACE_UINT16_FORMAT_SPECIFIER */

#if !defined (ACE_INT32_FORMAT_SPECIFIER)
#  if defined (PRId32)
#    define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId32)
#  elif ACE_SIZEOF_INT == 4
#    define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d")
#  else
#    define ACE_INT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld")
#  endif /* defined (PRId32) */
#endif /* ACE_INT32_FORMAT_SPECIFIER */

#if !defined (ACE_UINT32_FORMAT_SPECIFIER)
#  if defined (PRIu32)
#    define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu32)
#  elif ACE_SIZEOF_INT == 4
#    define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u")
#  else
#    define ACE_UINT32_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
#  endif /* defined (PRIu32) */
#endif /* ACE_UINT32_FORMAT_SPECIFIER */

#if !defined (ACE_INT64_FORMAT_SPECIFIER)
#  if defined (PRId64)
#    define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRId64)
#  elif ACE_SIZEOF_LONG == 8
#    define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld")
#  else
#    define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lld")
#  endif /* defined (PRId64) */
#endif /* ACE_INT64_FORMAT_SPECIFIER */

#if !defined (ACE_UINT64_FORMAT_SPECIFIER)
#  if defined (PRIu64)
#    define ACE_UINT64_FORMAT_SPECIFIER_A "%" PRIu64
#    define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
#  elif ACE_SIZEOF_LONG == 8
#    define ACE_UINT64_FORMAT_SPECIFIER_A "%lu"
#    define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
#  else
#    define ACE_UINT64_FORMAT_SPECIFIER_A "%llu"
#    define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
#  endif /* defined (PRIu64) */
#endif /* ACE_UINT64_FORMAT_SPECIFIER */

#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
#  define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%I64d"
#  define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
# else
#  define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%d"
#  define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
# endif /* ACE_WIN64 */
#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */

#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
#  define ACE_SIZE_T_FORMAT_SPECIFIER_A "%I64u"
#  define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
# else
#  define ACE_SIZE_T_FORMAT_SPECIFIER_A "%u"
#  define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
# endif /* ACE_WIN64 */
#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */

// Cast from UINT64 to a double requires an intermediate cast to INT64
// on some platforms.
# if defined (ACE_LACKS_LONGLONG_T)
   // Only use the low 32 bits.
#   define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n)
# elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
#   define ACE_UINT64_DBLCAST_ADAPTER(n) ((n).to_int64 ())
# elif defined (ACE_WIN32)
#   define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n)
# else  /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
#   define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */


// The number of bytes in a float.
# ifndef ACE_SIZEOF_FLOAT
#   if FLT_MAX_EXP == 128
#     define ACE_SIZEOF_FLOAT 4
#   elif FLT_MAX_EXP == 1024
#     define ACE_SIZEOF_FLOAT 8
#   else
#     error: unsupported float size, must be updated for this platform!
#   endif /* FLT_MAX_EXP */
# endif /* ACE_SIZEOF_FLOAT */

// The number of bytes in a double.
# ifndef ACE_SIZEOF_DOUBLE
#   if DBL_MAX_EXP == 128
#     define ACE_SIZEOF_DOUBLE 4
#   elif DBL_MAX_EXP == 1024
#     define ACE_SIZEOF_DOUBLE 8
#   else
#     error: unsupported double size, must be updated for this platform!
#   endif /* DBL_MAX_EXP */
# endif /* ACE_SIZEOF_DOUBLE */

// The number of bytes in a long double.
# ifndef ACE_SIZEOF_LONG_DOUBLE
#   if LDBL_MAX_EXP == 128
#     define ACE_SIZEOF_LONG_DOUBLE 4
#   elif LDBL_MAX_EXP == 1024
#     define ACE_SIZEOF_LONG_DOUBLE 8
#   elif LDBL_MAX_EXP == 16384
#     if defined (LDBL_DIG)  &&  LDBL_DIG == 18
#       if defined (__ia64) || defined (__x86_64)
#         define ACE_SIZEOF_LONG_DOUBLE 16
#       else /* ! __ia64 */
#       define ACE_SIZEOF_LONG_DOUBLE 12
#       endif /* __ia64 */
#     else  /* ! LDBL_DIG  ||  LDBL_DIG != 18 */
#       define ACE_SIZEOF_LONG_DOUBLE 16
#     endif /* ! LDBL_DIG  ||  LDBL_DIG != 18 */
#   else
#     error: unsupported double size, must be updated for this platform!
#   endif /* LDBL_MAX_EXP */
# endif /* ACE_SIZEOF_LONG_DOUBLE */

// Max and min sizes for the ACE integer types.
#define ACE_CHAR_MAX 0x7F
#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
#define ACE_OCTET_MAX 0xFF
#define ACE_INT16_MAX 0x7FFF
#define ACE_INT16_MIN -(ACE_INT16_MAX)-1
#define ACE_UINT16_MAX 0xFFFF
#define ACE_INT32_MAX 0x7FFFFFFF
#define ACE_INT32_MIN -(ACE_INT32_MAX)-1
#define ACE_UINT32_MAX 0xFFFFFFFF
#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
#define ACE_INT64_MIN -(ACE_INT64_MAX)-1
#define ACE_UINT64_MAX ACE_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF)
// These use ANSI/IEEE format.
#define ACE_FLT_MAX 3.402823466e+38F
#define ACE_DBL_MAX 1.7976931348623158e+308

# if defined (__ACE_INLINE__)
#   include "ace/Basic_Types.inl"
# endif /* __ACE_INLINE__ */

# include /**/ "ace/post.h"
#endif /* ACE_BASIC_TYPES_H */