Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Basic_Types.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Basic_Types.h
00006  *
00007  *  $Id: Basic_Types.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author David L. Levine
00010  *
00011  *  #defines the list of preprocessor macros below.  The config.h file can
00012  *  pre-define any of these to short-cut the definitions.  This is usually
00013  *  only necessary if the preprocessor does all of its math using integers.
00014  *
00015  *  Sizes of built-in types:
00016  *    - ACE_SIZEOF_CHAR
00017  *    - ACE_SIZEOF_WCHAR
00018  *    - ACE_SIZEOF_SHORT
00019  *    - ACE_SIZEOF_INT
00020  *    - ACE_SIZEOF_LONG
00021  *    - ACE_SIZEOF_LONG_LONG
00022  *    - ACE_SIZEOF_VOID_P
00023  *    - ACE_SIZEOF_FLOAT
00024  *    - ACE_SIZEOF_DOUBLE
00025  *    - ACE_SIZEOF_LONG_DOUBLE
00026  *
00027  *  Wrappers for built-in types of specific sizes:
00028  *    - ACE_USHORT16 (For backward compatibility.  Use ACE_UINT16 instead.)
00029  *    - ACE_INT16
00030  *    - ACE_UINT16
00031  *    - ACE_INT32
00032  *    - ACE_UINT32
00033  *    - ACE_UINT64
00034  *  (Note: ACE_INT64 is not defined, because there is no ACE_LongLong for
00035  *   platforms that don't have a native 8-byte integer type.)
00036  *
00037  *  Byte-order (endian-ness) determination:
00038  *    ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN
00039  *
00040  *
00041  */
00042 //=============================================================================
00043 
00044 #ifndef ACE_BASIC_TYPES_H
00045 # define ACE_BASIC_TYPES_H
00046 
00047 # include "ace/pre.h"
00048 
00049 # include "ace/config-all.h"
00050 
00051 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00052 #   pragma once
00053 # endif /* ACE_LACKS_PRAGMA_ONCE */
00054 
00055 // Pull in definitions
00056 # include /**/ <limits.h>   // Integer limits
00057 # include /**/ <float.h>    // Floating point limits
00058 # include /**/ <stdlib.h>   // Other types
00059 
00060 # if defined(ACE_LACKS_LONGLONG_T)
00061 #   include /**/ <stdarg.h> // LynxOS requires this before stdio.h
00062 #   include /**/ <stdio.h>  // For long long emulation
00063 # endif  /* ACE_LACKS_LONGLONG_T */
00064 
00065 # if !defined (ACE_LACKS_SYS_TYPES_H)
00066 #   include /**/ <sys/types.h>
00067 # endif  /* ACE_LACKS_SYS_TYPES_H */
00068 
00069 # if !defined (ACE_LACKS_PARAM_H)
00070 #  include /**/ <sys/param.h>
00071 # endif /* ACE_LACKS_PARAM_H */
00072 
00073 # include "ace/ACE_export.h"
00074 
00075 // Pick up MAXPATHLEN without need of OS.h.
00076 #if !defined (MAXPATHLEN)
00077 #  if defined (ACE_WIN32)
00078 #    define MAXPATHLEN  _MAX_PATH
00079 #  elif defined (_POSIX_PATH_MAX)
00080 #     define MAXPATHLEN _POSIX_PATH_MAX
00081 #  else
00082 #     define MAXPATHLEN 1024
00083 #  endif /* ACE_WIN32 */
00084 #endif /* MAXPATHLEN */
00085 
00086 // A char always has 1 byte, by definition.
00087 # define ACE_SIZEOF_CHAR 1
00088 
00089 // Unfortunately, there isn't a portable way to determine the size of a wchar.
00090 // So we just define them on a platform basis.
00091 # if defined (ACE_HAS_WCHAR)
00092 #   if !defined (ACE_SIZEOF_WCHAR)
00093 #     if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
00094 #       define ACE_SIZEOF_WCHAR sizeof (wchar_t)
00095 #     else
00096 // 0 so the Basic_Types test will catch this.
00097 #       define ACE_SIZEOF_WCHAR 0
00098 #     endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
00099 #   endif /* !ACE_SIZEOF_WCHAR */
00100 # endif /* ACE_HAS_WCHAR */
00101 
00102 // The number of bytes in a short.
00103 # if !defined (ACE_SIZEOF_SHORT)
00104 #   if (USHRT_MAX) == 255U
00105 #     define ACE_SIZEOF_SHORT 1
00106 #   elif (USHRT_MAX) == 65535U
00107 #     define ACE_SIZEOF_SHORT 2
00108 #   elif (USHRT_MAX) == 4294967295U
00109 #     define ACE_SIZEOF_SHORT 4
00110 #   elif (USHRT_MAX) == 18446744073709551615U
00111 #     define ACE_SIZEOF_SHORT 8
00112 #   else
00113 #     error: unsupported short size, must be updated for this platform!
00114 #   endif /* USHRT_MAX */
00115 # endif /* !defined (ACE_SIZEOF_SHORT) */
00116 
00117 // The number of bytes in an int.
00118 # if !defined (ACE_SIZEOF_INT)
00119 #   if (UINT_MAX) == 65535U
00120 #     define ACE_SIZEOF_INT 2
00121 #   elif (UINT_MAX) == 4294967295U
00122 #     define ACE_SIZEOF_INT 4
00123 #   elif (UINT_MAX) == 18446744073709551615U
00124 #     define ACE_SIZEOF_INT 8
00125 #   else
00126 #     error: unsupported int size, must be updated for this platform!
00127 #   endif /* UINT_MAX */
00128 # endif /* !defined (ACE_SIZEOF_INT) */
00129 
00130 // The number of bytes in a long.
00131 // NOTE - since preprocessors only need to do integer math, this is a likely
00132 // place for a preprocessor to not properly support being able to figure out
00133 // the proper size.  HP aC++ and GNU gcc have this difficulty so watch out.
00134 # if !defined (ACE_SIZEOF_LONG)
00135 #   if (ULONG_MAX) == 65535UL
00136 #     define ACE_SIZEOF_LONG 2
00137 #   elif ((ULONG_MAX) == 4294967295UL)
00138 #     define ACE_SIZEOF_LONG 4
00139 #   elif ((ULONG_MAX) == 18446744073709551615UL)
00140 #     define ACE_SIZEOF_LONG 8
00141 #   else
00142 #     error: unsupported long size, must be updated for this platform!
00143 #   endif /* ULONG_MAX */
00144 # endif /* !defined (ACE_SIZEOF_LONG) */
00145 
00146 // The number of bytes in a long long.
00147 # if !defined (ACE_SIZEOF_LONG_LONG)
00148 #   if defined (ACE_LACKS_LONGLONG_T)
00149 #     define ACE_SIZEOF_LONG_LONG 8
00150 #   else  /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
00151 #     if ACE_SIZEOF_LONG == 8
00152 #       define ACE_SIZEOF_LONG_LONG 8
00153        typedef unsigned long ACE_UINT64;
00154 #     elif defined (ULLONG_MAX) && !defined (__GNUG__)
00155        // Some compilers use ULLONG_MAX and others, e.g. Irix, use
00156        // ULONGLONG_MAX.
00157 #       if (ULLONG_MAX) == 18446744073709551615ULL
00158 #         define ACE_SIZEOF_LONG_LONG 8
00159 #       elif (ULLONG_MAX) == 4294967295ULL
00160 #         define ACE_SIZEOF_LONG_LONG 4
00161 #       else
00162 #         error Unsupported long long size needs to be updated for this platform
00163 #       endif
00164        typedef unsigned long long ACE_UINT64;
00165 #     elif defined (ULONGLONG_MAX) && !defined (__GNUG__)
00166        // Irix 6.x, for example.
00167 #       if (ULONGLONG_MAX) == 18446744073709551615ULL
00168 #         define ACE_SIZEOF_LONG_LONG 8
00169 #       elif (ULONGLONG_MAX) == 4294967295ULL
00170 #         define ACE_SIZEOF_LONG_LONG 4
00171 #       else
00172 #         error Unsupported long long size needs to be updated for this platform
00173 #       endif
00174        typedef unsigned long long ACE_UINT64;
00175 #     else
00176        // ACE_SIZEOF_LONG_LONG is not yet known, but the platform doesn't
00177        // claim ACE_LACKS_LONGLONG_T, so assume it has 8-byte long longs.
00178 #       define ACE_SIZEOF_LONG_LONG 8
00179 #       if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T)
00180          // sun #defines u_longlong_t, maybe other platforms do also.
00181          // Use it, at least with g++, so that its -pedantic doesn't
00182          // complain about no ANSI C++ long long.
00183          typedef u_longlong_t ACE_UINT64;
00184 #       else
00185          // LynxOS 2.5.0 and Linux don't have u_longlong_t.
00186          typedef unsigned long long ACE_UINT64;
00187 #       endif /* sun */
00188 #     endif /* ULLONG_MAX && !__GNUG__ */
00189 #   endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
00190 # endif /* !defined (ACE_SIZEOF_LONG_LONG) */
00191 
00192 // The sizes of the commonly implemented types are now known.  Set up
00193 // typedefs for whatever we can.  Some of these are needed for certain cases
00194 // of ACE_UINT64, so do them before the 64-bit stuff.
00195 
00196 # if ACE_SIZEOF_SHORT == 2
00197   typedef short ACE_INT16;
00198   typedef unsigned short ACE_UINT16;
00199 # elif ACE_SIZEOF_INT == 2
00200   typedef int ACE_INT16;
00201   typedef unsigned int ACE_UINT16;
00202 # elif (ACE_SIZEOF_SHORT) == 4 && defined(_CRAYMPP)
00203   // mpp cray - uses Alpha processors
00204   //   Use the real 32-bit quantity for ACE_INT32's, and use a "long"
00205   //   for ACE_INT16's.  This gets around conflicts with size_t in some ACE
00206   //   method signatures, among other things.
00207   typedef long ACE_INT16;
00208   typedef unsigned long ACE_UINT16;
00209   typedef short ACE_INT32;
00210   typedef unsigned short ACE_UINT32;
00211 # elif (ACE_SIZEOF_SHORT) == 8 && defined(_UNICOS)
00212   // vector cray - hard 64-bit, all 64 bit types
00213   typedef short ACE_INT16;
00214   typedef unsigned short ACE_UINT16;
00215 # else
00216 #   error Have to add to the ACE_UINT16 type setting
00217 # endif
00218 
00219 typedef ACE_UINT16 ACE_USHORT16;
00220 
00221 // Define a generic byte for use in codecs
00222 typedef unsigned char ACE_Byte;
00223 
00224 // Define a pseudo wide character type when wchar is not supported so we
00225 // can support basic wide character string operations.
00226 
00227 # if defined (ACE_HAS_WCHAR)
00228 #   define ACE_WINT_T wint_t
00229 #   define ACE_WCHAR_T wchar_t
00230 # else
00231 #   define ACE_WINT_T ACE_USHORT16
00232 #   define ACE_WCHAR_T ACE_USHORT16
00233 # endif /* ACE_HAS_WCHAR */
00234 
00235 # if ACE_SIZEOF_INT == 4
00236   typedef int ACE_INT32;
00237   typedef unsigned int ACE_UINT32;
00238 #   if defined (__KCC) && !defined (ACE_LACKS_LONGLONG_T)
00239   typedef unsigned long long ACE_UINT64;
00240 #   endif /* __KCC */
00241 # elif ACE_SIZEOF_LONG == 4
00242   typedef long ACE_INT32;
00243   typedef unsigned long ACE_UINT32;
00244 # elif (ACE_SIZEOF_INT) == 8 && defined(_UNICOS)
00245   // vector cray - hard 64-bit, all 64 bit types
00246 #   if !defined(_CRAYMPP)
00247       typedef int ACE_INT32;
00248       typedef unsigned int ACE_UINT32;
00249 #   endif
00250   typedef unsigned long long ACE_UINT64;
00251 # else
00252 #   error Have to add to the ACE_UINT32 type setting
00253 # endif
00254 
00255 // The number of bytes in a void *.
00256 # ifndef ACE_SIZEOF_VOID_P
00257 #   define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
00258 # endif /* ACE_SIZEOF_VOID_P */
00259 
00260 // Type for doing arithmetic on pointers ... as elsewhere, we assume
00261 // that unsigned versions of a type are the same size as the signed
00262 // version of the same type.
00263 #if ACE_SIZEOF_VOID_P == ACE_SIZEOF_INT
00264 # if defined (__SUNPRO_CC)
00265     // For unknown reasons, Sun CC 5.0 won't allow a reintepret cast
00266     // of a 64-bit pointer to a 64-bit int.
00267     typedef unsigned long ptr_arith_t;
00268 # else  /* ! __SUNPRO_CC */
00269     typedef unsigned int ptr_arith_t;
00270 # endif /* ! __SUNPRO_CC */
00271 #elif ACE_SIZEOF_VOID_P == ACE_SIZEOF_LONG
00272   typedef unsigned long ptr_arith_t;
00273 #elif ACE_SIZEOF_VOID_P == ACE_SIZEOF_LONG_LONG
00274   typedef unsigned long long ptr_arith_t;
00275 #else
00276 # error "Can't find a suitable type for doing pointer arithmetic."
00277 #endif /* ACE_SIZEOF_VOID_P */
00278 
00279 #if defined (ACE_LACKS_LONGLONG_T)
00280   // This throws away the high 32 bits.  It's very unlikely that a
00281   // pointer will be more than 32 bits wide if the platform does not
00282   // support 64-bit integers.
00283 # define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
00284   ACE_reinterpret_cast (PTR_TYPE, L.lo ())
00285 #else  /* ! ACE_LACKS_LONGLONG_T */
00286 # define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \
00287   ACE_reinterpret_cast (PTR_TYPE, ACE_static_cast (ptr_arith_t, L))
00288 #endif /* ! ACE_LACKS_LONGLONG_T */
00289 
00290 // If the platform lacks a long long, define one.
00291 # if defined (ACE_LACKS_LONGLONG_T)
00292 # if defined (ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION)
00293 // Forward declaration for streams
00294 #   include "ace/iosfwd.h"
00295 # else /* ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION */
00296 // Else they will get all the stream header files
00297 #   include "ace/streams.h"
00298 # endif /* ACE_HAS_MINIMUM_IOSTREAMH_INCLUSION */
00299 
00300 /**
00301  * @class ACE_U_LongLong
00302  *
00303  * @brief Unsigned long long for platforms that don't have one.
00304  *
00305  * Provide our own unsigned long long.  This is intended to be
00306  * use with ACE_High_Res_Timer, so the division operator assumes
00307  * that the quotient fits into a u_long.
00308  * Please note that the constructor takes (optionally) two values.
00309  * The high one contributes 0x100000000 times its value.  So,
00310  * for example, (0, 2) is _not_ 20000000000, but instead
00311  * 0x200000000.  To emphasize this, the default values are expressed
00312  * in hex, and output () dumps the value in hex.
00313  */
00314   class ACE_Export ACE_U_LongLong
00315   {
00316   public:
00317     // = Initialization and termination methods.
00318     ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0);
00319     ACE_U_LongLong (const ACE_U_LongLong &);
00320     ACE_U_LongLong &operator= (const ACE_U_LongLong &);
00321     ~ACE_U_LongLong (void);
00322 
00323     // = Overloaded relation operators.
00324     int operator== (const ACE_U_LongLong &) const;
00325     int operator== (const ACE_UINT32) const;
00326     int operator!= (const ACE_U_LongLong &) const;
00327     int operator!= (const ACE_UINT32) const;
00328     int operator< (const ACE_U_LongLong &) const;
00329     int operator< (const ACE_UINT32) const;
00330     int operator<= (const ACE_U_LongLong &) const;
00331     int operator<= (const ACE_UINT32) const;
00332     int operator> (const ACE_U_LongLong &) const;
00333     int operator> (const ACE_UINT32) const;
00334     int operator>= (const ACE_U_LongLong &) const;
00335     int operator>= (const ACE_UINT32) const;
00336 
00337     ACE_U_LongLong operator+ (const ACE_U_LongLong &) const;
00338     ACE_U_LongLong operator+ (const ACE_UINT32) const;
00339     ACE_U_LongLong operator- (const ACE_U_LongLong &) const;
00340     ACE_U_LongLong operator- (const ACE_UINT32) const;
00341     ACE_U_LongLong operator* (const ACE_UINT32) const;
00342     ACE_U_LongLong &operator*= (const ACE_UINT32);
00343 
00344     ACE_U_LongLong operator<< (const unsigned int) const;
00345     ACE_U_LongLong &operator<<= (const unsigned int);
00346     ACE_U_LongLong operator>> (const unsigned int) const;
00347     ACE_U_LongLong &operator>>= (const unsigned int);
00348 
00349     double operator/ (const double) const;
00350 
00351     ACE_U_LongLong &operator+= (const ACE_U_LongLong &);
00352     ACE_U_LongLong &operator+= (const ACE_UINT32);
00353     ACE_U_LongLong &operator-= (const ACE_U_LongLong &);
00354     ACE_U_LongLong &operator-= (const ACE_UINT32);
00355     ACE_U_LongLong &operator++ ();
00356     ACE_U_LongLong &operator-- ();
00357     ACE_U_LongLong &operator|= (const ACE_U_LongLong);
00358     ACE_U_LongLong &operator|= (const ACE_UINT32);
00359     ACE_U_LongLong &operator&= (const ACE_U_LongLong);
00360     ACE_U_LongLong &operator&= (const ACE_UINT32);
00361 
00362     // Note that the following take ACE_UINT32 arguments.  These are
00363     // typical use cases, and easy to implement.  But, they limit the
00364     // return values to 32 bits as well.  There are no checks for
00365     // overflow.
00366     ACE_UINT32 operator/ (const ACE_UINT32) const;
00367     ACE_UINT32 operator% (const ACE_UINT32) const;
00368 
00369     // The following only operate on the lower 32 bits (they take only
00370     // 32 bit arguments).
00371     ACE_UINT32 operator| (const ACE_INT32) const;
00372     ACE_UINT32 operator& (const ACE_INT32) const;
00373 
00374     // The following operators convert their arguments to
00375     // ACE_UINT32.  So, there may be information loss if they are
00376     // used.
00377     ACE_U_LongLong operator* (const ACE_INT32) const;
00378     ACE_U_LongLong &operator*= (const ACE_INT32);
00379     ACE_UINT32 operator/ (const ACE_INT32) const;
00380 #   if ACE_SIZEOF_INT == 4
00381     ACE_UINT32 operator/ (const unsigned long) const;
00382     ACE_UINT32 operator/ (const long) const;
00383 #   else  /* ACE_SIZEOF_INT != 4 */
00384     ACE_UINT32 operator/ (const unsigned int) const;
00385     ACE_UINT32 operator/ (const int) const;
00386 #   endif /* ACE_SIZEOF_INT != 4 */
00387 
00388     // = Helper methods.
00389     /// Outputs the value to the FILE, in hex.
00390     void output (FILE * = stdout) const;
00391 
00392     ACE_TCHAR *as_string (ACE_TCHAR *string,
00393                           unsigned int base = 10,
00394                           unsigned int uppercase = 0) const;
00395 
00396     ACE_UINT32 hi (void) const;
00397     ACE_UINT32 lo (void) const;
00398 
00399     void hi (const ACE_UINT32 hi);
00400     void lo (const ACE_UINT32 lo);
00401 
00402   private:
00403     union
00404       {
00405         struct
00406           {
00407             ACE_UINT32 hi_;
00408             // High 32 bits.
00409 
00410             ACE_UINT32 lo_;
00411             // Low 32 bits.
00412           } data_;
00413         // To ensure alignment on 8-byte boundary.
00414 
00415         // double isn't usually usable with ACE_LACKS_FLOATING_POINT,
00416         // but this seems OK.
00417         double for_alignment_;
00418         // To ensure alignment on 8-byte boundary.
00419       };
00420 
00421     // NOTE:  the following four accessors are inlined here in
00422     // order to minimize the extent of the data_ struct.  It's
00423     // only used here; the .i and .cpp files use the accessors.
00424 
00425     /// Internal utility function to hide access through struct.
00426     const ACE_UINT32 &h_ () const { return data_.hi_; }
00427 
00428     /// Internal utility function to hide access through struct.
00429     ACE_UINT32 &h_ () { return data_.hi_; }
00430 
00431     /// Internal utility function to hide access through struct.
00432     const ACE_UINT32 &l_ () const { return data_.lo_; }
00433 
00434     /// Internal utility function to hide access through struct.
00435     ACE_UINT32 &l_ () { return data_.lo_; }
00436 
00437     // NOTE:  the above four accessors are inlined here in
00438     // order to minimize the extent of the data_ struct.  It's
00439     // only used here; the .i and .cpp files use the accessors.
00440 
00441     /// These functions are used to implement multiplication.
00442     ACE_UINT32 ul_shift (ACE_UINT32 a,
00443                          ACE_UINT32 c_in,
00444                          ACE_UINT32 *c_out) const;
00445     ACE_U_LongLong ull_shift (ACE_U_LongLong a,
00446                               ACE_UINT32 c_in,
00447                               ACE_UINT32 *c_out) const;
00448     ACE_U_LongLong ull_add (ACE_U_LongLong a,
00449                             ACE_U_LongLong b,
00450                             ACE_UINT32 *carry) const;
00451     ACE_U_LongLong ull_mult (ACE_U_LongLong a,
00452                              ACE_UINT32 b,
00453                              ACE_UINT32 *carry) const;
00454   };
00455 
00456   typedef ACE_U_LongLong ACE_UINT64;
00457 
00458 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00459   ostream &operator<< (ostream &, const ACE_U_LongLong &);
00460 #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
00461 
00462 # endif /* ACE_LACKS_LONGLONG_T */
00463 
00464 // Conversions from ACE_UINT64 to ACE_UINT32.  ACE_CU64_TO_CU32 should
00465 // be used on const ACE_UINT64's.
00466 # if defined (ACE_LACKS_LONGLONG_T)
00467 #   define ACE_U64_TO_U32(n) ((n).lo ())
00468 #   define ACE_CU64_TO_CU32(n) ((n).lo ())
00469 # else  /* ! ACE_LACKS_LONGLONG_T */
00470 #   define ACE_U64_TO_U32(n) (ACE_static_cast (ACE_UINT32, (n)))
00471 #   define ACE_CU64_TO_CU32(n) \
00472      (ACE_static_cast (ACE_CAST_CONST ACE_UINT32, (n)))
00473 # endif /* ! ACE_LACKS_LONGLONG_T */
00474 
00475 // 64-bit literals require special marking on some platforms.
00476 # if defined (ACE_LACKS_LONGLONG_T)
00477     // Can only specify 32-bit arguments.
00478 #   define ACE_UINT64_LITERAL(n) (ACE_U_LongLong (n))
00479       // This one won't really work, but it'll keep
00480       // some compilers happy until we have better support
00481 #   define ACE_INT64_LITERAL(n) (ACE_U_LongLong (n))
00482 # elif defined (ACE_WIN32)
00483 #  if defined (__IBMCPP__) && (__IBMCPP__ >= 400)
00484 #   define ACE_UINT64_LITERAL(n) n ## LL
00485 #   define ACE_INT64_LITERAL(n) n ## LL
00486 #  elif defined (__MINGW32__)
00487 #   define ACE_UINT64_LITERAL(n) n ## ull
00488 #   define ACE_INT64_LITERAL(n) n ## ll
00489 #  else
00490 #   define ACE_UINT64_LITERAL(n) n ## ui64
00491 #   define ACE_INT64_LITERAL(n) n ## i64
00492 #  endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) */
00493 # else  /* ! ACE_WIN32  &&  ! ACE_LACKS_LONGLONG_T */
00494 #   define ACE_UINT64_LITERAL(n) n ## ull
00495 #   define ACE_INT64_LITERAL(n) n ## ll
00496 # endif /* ! ACE_WIN32  &&  ! ACE_LACKS_LONGLONG_T */
00497 
00498 #if !defined (ACE_UINT64_FORMAT_SPECIFIER)
00499 # define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%llu")
00500 #endif /* ACE_UINT64_FORMAT_SPECIFIER */
00501 
00502 #if !defined (ACE_INT64_FORMAT_SPECIFIER)
00503 # define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lld")
00504 #endif /* ACE_INT64_FORMAT_SPECIFIER */
00505 
00506 #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
00507 # if defined (ACE_WIN64)
00508 #  define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
00509 # else
00510 #  define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d")
00511 # endif /* ACE_WIN64 */
00512 #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
00513 
00514 #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
00515 # if defined (ACE_WIN64)
00516 #  define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
00517 # else
00518 #  define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u")
00519 # endif /* ACE_WIN64 */
00520 #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
00521 
00522 // Cast from UINT64 to a double requires an intermediate cast to INT64
00523 // on some platforms.
00524 # if defined (ACE_LACKS_LONGLONG_T)
00525    // Only use the low 32 bits.
00526 #   define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n)
00527 # elif defined (ACE_WIN32)
00528 #   define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_static_cast (__int64, n)
00529 # else  /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
00530 #   define ACE_UINT64_DBLCAST_ADAPTER(n) (n)
00531 # endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */
00532 
00533 
00534 // The number of bytes in a float.
00535 # ifndef ACE_SIZEOF_FLOAT
00536 #   if FLT_MAX_EXP == 128
00537 #     define ACE_SIZEOF_FLOAT 4
00538 #   elif FLT_MAX_EXP == 1024
00539 #     define ACE_SIZEOF_FLOAT 8
00540 #   else
00541 #     error: unsupported float size, must be updated for this platform!
00542 #   endif /* FLT_MAX_EXP */
00543 # endif /* ACE_SIZEOF_FLOAT */
00544 
00545 // The number of bytes in a double.
00546 # ifndef ACE_SIZEOF_DOUBLE
00547 #   if DBL_MAX_EXP == 128
00548 #     define ACE_SIZEOF_DOUBLE 4
00549 #   elif DBL_MAX_EXP == 1024
00550 #     define ACE_SIZEOF_DOUBLE 8
00551 #   else
00552 #     error: unsupported double size, must be updated for this platform!
00553 #   endif /* DBL_MAX_EXP */
00554 # endif /* ACE_SIZEOF_DOUBLE */
00555 
00556 // The number of bytes in a long double.
00557 # ifndef ACE_SIZEOF_LONG_DOUBLE
00558 #   if LDBL_MAX_EXP == 128
00559 #     define ACE_SIZEOF_LONG_DOUBLE 4
00560 #   elif LDBL_MAX_EXP == 1024
00561 #     define ACE_SIZEOF_LONG_DOUBLE 8
00562 #   elif LDBL_MAX_EXP == 16384
00563 #     if defined (LDBL_DIG)  &&  LDBL_DIG == 18
00564 #       if defined (__ia64)
00565 #         define ACE_SIZEOF_LONG_DOUBLE 16
00566 #       else /* ! __ia64 */
00567 #       define ACE_SIZEOF_LONG_DOUBLE 12
00568 #       endif /* __ia64 */
00569 #     else  /* ! LDBL_DIG  ||  LDBL_DIG != 18 */
00570 #       define ACE_SIZEOF_LONG_DOUBLE 16
00571 #     endif /* ! LDBL_DIG  ||  LDBL_DIG != 18 */
00572 #   else
00573 #     error: unsupported double size, must be updated for this platform!
00574 #   endif /* LDBL_MAX_EXP */
00575 # endif /* ACE_SIZEOF_LONG_DOUBLE */
00576 
00577 // Max and min sizes for the ACE integer types.
00578 #define ACE_CHAR_MAX 0x7F
00579 #define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
00580 #define ACE_OCTET_MAX 0xFF
00581 #define ACE_INT16_MAX 0x7FFF
00582 #define ACE_INT16_MIN -(ACE_INT16_MAX)-1
00583 #define ACE_UINT16_MAX 0xFFFF
00584 #define ACE_WCHAR_MAX ACE_UINT16_MAX
00585 #define ACE_INT32_MAX 0x7FFFFFFF
00586 #define ACE_INT32_MIN -(ACE_INT32_MAX)-1
00587 #define ACE_UINT32_MAX 0xFFFFFFFF
00588 #define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
00589 #define ACE_INT64_MIN -(ACE_INT64_MAX)-1
00590 #define ACE_UINT64_MAX ACE_UINT64_LITERAL(0xFFFFFFFFFFFFFFFF)
00591 // These use ANSI/IEEE format.
00592 #define ACE_FLT_MAX 3.402823466e+38F
00593 #define ACE_DBL_MAX 1.7976931348623158e+308
00594 
00595 // Byte-order (endian-ness) determination.
00596 # if defined (BYTE_ORDER)
00597 #   if (BYTE_ORDER == LITTLE_ENDIAN)
00598 #     define ACE_LITTLE_ENDIAN 0x0123
00599 #     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
00600 #   elif (BYTE_ORDER == BIG_ENDIAN)
00601 #     define ACE_BIG_ENDIAN 0x3210
00602 #     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
00603 #   else
00604 #     error: unknown BYTE_ORDER!
00605 #   endif /* BYTE_ORDER */
00606 # elif defined (_BYTE_ORDER)
00607 #   if (_BYTE_ORDER == _LITTLE_ENDIAN)
00608 #     define ACE_LITTLE_ENDIAN 0x0123
00609 #     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
00610 #   elif (_BYTE_ORDER == _BIG_ENDIAN)
00611 #     define ACE_BIG_ENDIAN 0x3210
00612 #     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
00613 #   else
00614 #     error: unknown _BYTE_ORDER!
00615 #   endif /* _BYTE_ORDER */
00616 # elif defined (__BYTE_ORDER)
00617 #   if (__BYTE_ORDER == __LITTLE_ENDIAN)
00618 #     define ACE_LITTLE_ENDIAN 0x0123
00619 #     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
00620 #   elif (__BYTE_ORDER == __BIG_ENDIAN)
00621 #     define ACE_BIG_ENDIAN 0x3210
00622 #     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
00623 #   else
00624 #     error: unknown __BYTE_ORDER!
00625 #   endif /* __BYTE_ORDER */
00626 # else /* ! BYTE_ORDER && ! __BYTE_ORDER */
00627   // We weren't explicitly told, so we have to figure it out . . .
00628 #   if defined (i386) || defined (__i386__) || defined (_M_IX86) || \
00629      defined (vax) || defined (__alpha) || defined (__LITTLE_ENDIAN__) ||\
00630      defined (ARM) || defined (_M_IA64)
00631     // We know these are little endian.
00632 #     define ACE_LITTLE_ENDIAN 0x0123
00633 #     define ACE_BYTE_ORDER ACE_LITTLE_ENDIAN
00634 #   else
00635     // Otherwise, we assume big endian.
00636 #     define ACE_BIG_ENDIAN 0x3210
00637 #     define ACE_BYTE_ORDER ACE_BIG_ENDIAN
00638 #   endif
00639 # endif /* ! BYTE_ORDER && ! __BYTE_ORDER */
00640 
00641 #if !defined (ACE_HAS_SSIZE_T)
00642 #  if defined (ACE_WIN64)
00643   typedef SSIZE_T ssize_t;
00644 #  else
00645   typedef int ssize_t;
00646 #  endif /* ACE_WIN64 */
00647 #endif /* ACE_HAS_SSIZE_T */
00648 
00649 # if defined (__ACE_INLINE__)
00650 #   include "ace/Basic_Types.i"
00651 # endif /* __ACE_INLINE__ */
00652 
00653 # include "ace/post.h"
00654 #endif /* ACE_BASIC_TYPES_H */

Generated on Mon Jun 16 11:19:13 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002