diff options
author | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-31 19:04:39 +0000 |
---|---|---|
committer | elliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2007-01-31 19:04:39 +0000 |
commit | 4c06aa0c094d490f8dda31e6c58ea9f0e209033d (patch) | |
tree | b8760292b42947418b364d03203a090fb7407828 /ACE/ace/CDR_Base.h | |
parent | aec7d8d0532f1588b30fe81d38a0b5dbdb59b398 (diff) | |
download | ATCD-4c06aa0c094d490f8dda31e6c58ea9f0e209033d.tar.gz |
ChangeLogTag: Wed Jan 31 19:03:37 UTC 2007 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'ACE/ace/CDR_Base.h')
-rw-r--r-- | ACE/ace/CDR_Base.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/ACE/ace/CDR_Base.h b/ACE/ace/CDR_Base.h index 42541504934..3507b21c4ae 100644 --- a/ACE/ace/CDR_Base.h +++ b/ACE/ace/CDR_Base.h @@ -267,15 +267,66 @@ public: # if ACE_SIZEOF_LONG_DOUBLE == 16 typedef long double LongDouble; # define ACE_CDR_LONG_DOUBLE_INITIALIZER 0 +# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS = RHS # else # define NONNATIVE_LONGDOUBLE # define ACE_CDR_LONG_DOUBLE_INITIALIZER {{0}} +# define ACE_CDR_LONG_DOUBLE_ASSIGNMENT(LHS, RHS) LHS.assign (RHS) struct ACE_Export LongDouble { + // VxWorks' compiler (gcc 2.96) gets confused by the operator long + // double, so we avoid using long double as the NativeImpl. + // Linux's x86 long double format (12 or 16 bytes) is incompatible + // with Windows, Solaris, AIX, MacOS X and HP-UX (and probably others) + // long double format (8 or 16 bytes). If you need 32-bit Linux to + // inter-operate with 64-bit Linux you will want to define this + // macro so that "long double" is used. Otherwise, do not define + // this macro. +# if defined (ACE_IMPLEMENT_WITH_NATIVE_LONGDOUBLE) || \ + (!defined (linux) && !defined (VXWORKS)) + typedef long double NativeImpl; +# else + typedef double NativeImpl; +# endif /* ACE_IMPLEMENT_WITH_NATIVE_LONGDOUBLE || (!linux && !VXWORKS) */ + char ld[16]; + + LongDouble& assign (const NativeImpl& rhs); + LongDouble& assign (const LongDouble& rhs); + bool operator== (const LongDouble &rhs) const; bool operator!= (const LongDouble &rhs) const; - // @@ also need other comparison operators. + + LongDouble& operator*= (const NativeImpl rhs) { + return this->assign (static_cast<NativeImpl> (*this) * rhs); + } + LongDouble& operator/= (const NativeImpl rhs) { + return this->assign (static_cast<NativeImpl> (*this) / rhs); + } + LongDouble& operator+= (const NativeImpl rhs) { + return this->assign (static_cast<NativeImpl> (*this) + rhs); + } + LongDouble& operator-= (const NativeImpl rhs) { + return this->assign (static_cast<NativeImpl> (*this) - rhs); + } + LongDouble& operator++ () { + return this->assign (static_cast<NativeImpl> (*this) + 1); + } + LongDouble& operator-- () { + return this->assign (static_cast<NativeImpl> (*this) - 1); + } + LongDouble operator++ (int) { + LongDouble ldv = *this; + this->assign (static_cast<NativeImpl> (*this) + 1); + return ldv; + } + LongDouble operator-- (int) { + LongDouble ldv = *this; + this->assign (static_cast<NativeImpl> (*this) - 1); + return ldv; + } + + operator NativeImpl () const; }; # endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */ |