diff options
Diffstat (limited to 'ace/Basic_Types.h')
-rw-r--r-- | ace/Basic_Types.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index cc4530c8b13..f9aaedf009d 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -165,10 +165,10 @@ # elif (ACE_SIZEOF_SHORT) == 4 && defined(_CRAYMPP) // mpp cray - uses Alpha processors // Use the real 32-bit quantity for ACE_INT32's, and use a "long" - // for ACE_INT16's. This gets around conflicts with size_t in some ACE + // for shorts. This gets around conflicts with size_t in some ACE // method signatures, among other things. - typedef long ACE_INT16; - typedef unsigned long ACE_UINT16; + typedef short ACE_INT16; + typedef unsigned short ACE_UINT16; typedef short ACE_INT32; typedef unsigned short ACE_UINT32; # elif (ACE_SIZEOF_SHORT) == 8 && defined(_UNICOS) @@ -196,7 +196,7 @@ typedef ACE_UINT16 ACE_USHORT16; typedef int ACE_INT32; typedef unsigned int ACE_UINT32; # endif - typedef unsigned long long ACE_UINT64; + typedef unsigned long ACE_UINT64; # else # error Have to add to the ACE_UINT32 type setting # endif @@ -219,17 +219,6 @@ typedef ACE_UINT16 ACE_USHORT16; # error "Can't find a suitable type for doing pointer arithmetic." #endif /* ACE_SIZEOF_VOID_P */ -#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) \ - ACE_reinterpret_cast (PTR_TYPE, L.lo ()) -#else /* ! ACE_LACKS_LONGLONG_T */ -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - ACE_reinterpret_cast (PTR_TYPE, ACE_static_cast (ptr_arith_t, L)) -#endif /* ! ACE_LACKS_LONGLONG_T */ - // If the platform lacks a long long, define one. # if defined (ACE_LACKS_LONGLONG_T) class ACE_Export ACE_U_LongLong @@ -318,6 +307,18 @@ typedef ACE_UINT16 ACE_USHORT16; ACE_UINT32 operator/ (const int) const; # endif /* ACE_SIZEOF_INT != 4 */ + // Conversion operator. Try to avoid adding more of these, + // because they can lead to subtle problems. But a conversion to + // ptr_arith_t is useful. +# if ACE_SIZEOF_VOID_P == ACE_SIZEOF_INT || \ + ACE_SIZEOF_VOID_P == ACE_SIZEOF_LONG + operator ptr_arith_t () { return data_.lo_; } +# elif ACE_SIZEOF_VOID_P == ACE_SIZEOF_LONG_LONG + operator ptr_arith_t () { return data_.hi_ << 32U & data_.lo_; } +# else +# error "Can't find a suitable type for doing pointer arithmetic." +# endif /* ACE_SIZEOF_VOID_P */ + // = Helper methods. void output (FILE * = stdout) const; // Outputs the value to the FILE, in hex. |