diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-22 02:57:35 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-22 02:57:35 +0000 |
commit | 03c142172834a6b2d86ca5fc3fa9d2a1549e2a10 (patch) | |
tree | dd20d61439d20ef9983709e11180ce2044d18755 /ace | |
parent | a3286d5bd77734aacef6416513a72301b47ccb82 (diff) | |
download | ATCD-03c142172834a6b2d86ca5fc3fa9d2a1549e2a10.tar.gz |
(sema_open): changed return type from sem_t * to ACE_sema_t *; ACE_U_LongLong: removed normalize ()
Diffstat (limited to 'ace')
-rw-r--r-- | ace/OS.cpp | 11 | ||||
-rw-r--r-- | ace/OS.h | 27 | ||||
-rw-r--r-- | ace/OS.i | 41 |
3 files changed, 25 insertions, 54 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index 7510e9f6670..5afaad79d41 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -189,18 +189,11 @@ ACE_U_LongLong::dump (FILE *file) const { if (hi_ > 0) { -# if ULONG_MAX == 4294967295UL - // 32-bit unsigned long, which has 10 decimal digits. - // We only keep 9 in the lo_ member of ACE_U_LongLong - // (0 thru 999999999), though. - ACE_OS::fprintf (file, "%lu%09lu", hi_, lo_); -# else -# error Unsupported ULONG_MAX size -# endif /* ULONG_MAX */ + ACE_OS::fprintf (file, "0x%lx%0*lx", hi_, 2 * sizeof lo_, lo_); } else { - ACE_OS::fprintf (file, "%lu", lo_); + ACE_OS::fprintf (file, "0x%lx", lo_); } } #endif /* ! ACE_WIN32 && ! ACE_HAS_LONGLONG_T */ @@ -2385,14 +2385,22 @@ typedef short ACE_pri_t; typedef unsigned long long ACE_hrtime_t; #endif /* __GNUC__ */ #else - // 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. class ACE_U_LongLong { + // = TITLE + // Unsigned long long for platforms that don't have one. + // + // = DESCRIPTION + // 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 dump () outputs the value in hex. public: - ACE_U_LongLong () : hi_ (0), lo_ (0) {} - ACE_U_LongLong (u_long lo, u_long hi = 0); + ACE_U_LongLong (u_long lo = 0x0, u_long hi = 0x0); ACE_U_LongLong (const ACE_U_LongLong &); ACE_U_LongLong &operator= (const ACE_U_LongLong &); ~ACE_U_LongLong () {} @@ -2411,6 +2419,7 @@ typedef short ACE_pri_t; ACE_U_LongLong &operator-= (const ACE_U_LongLong &); void dump (FILE * = stdout) const; + // Outputs the value to the FILE, in hex. u_long hi () const { return hi_; } u_long lo () const { return lo_; } @@ -2423,10 +2432,6 @@ typedef short ACE_pri_t; private: u_long hi_; u_long lo_; - - // Only store 0 thru 999999999 in lo_ word, to allow arithmetic - // operations to work correctly. - void normalize (); }; typedef ACE_U_LongLong ACE_hrtime_t; @@ -3209,8 +3214,8 @@ public: // = A set of wrappers for semaphores. static int sema_destroy (ACE_sema_t *s); - static sem_t *sema_open (const char *name, int oflag, - u_long mode, u_int value); + static ACE_sema_t *sema_open (const char *name, int oflag, + u_long mode, u_int value); static int sema_init (ACE_sema_t *s, u_int count, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0, int max = 0x7fffffff); @@ -1781,7 +1781,7 @@ ACE_OS::sema_destroy (ACE_sema_t *s) #endif /* ACE_HAS_POSIX_SEM */ } -ACE_INLINE sem_t * +ACE_INLINE ACE_sema_t * ACE_OS::sema_open (const char *name, int oflag, u_long mode, u_int value) { @@ -1792,7 +1792,7 @@ ACE_OS::sema_open (const char *name, int oflag, ACE_UNUSED_ARG(oflag); ACE_UNUSED_ARG(mode); ACE_UNUSED_ARG(value); - ACE_NOTSUP_RETURN (-1); + ACE_NOTSUP_RETURN ((ACE_sema_t *) -1); #endif /* defined (ACE_HAS_POSIX_SEM) && !defined (CHORUS) */ } @@ -6439,22 +6439,10 @@ ACE_OS::dup2 (ACE_HANDLE oldhandle, ACE_HANDLE newhandle) } #if ! defined (ACE_WIN32) && ! defined (ACE_HAS_LONGLONG_T) -ACE_INLINE void -ACE_U_LongLong::normalize () -{ - while (lo_ > 999999999) - { - lo_ -= 1000000000; - ++hi_; - } -} - - ACE_INLINE ACE_U_LongLong::ACE_U_LongLong (u_long lo, u_long hi) : hi_ (hi), lo_ (lo) { - normalize (); } ACE_INLINE int @@ -6506,23 +6494,15 @@ ACE_INLINE ACE_U_LongLong ACE_U_LongLong::operator+ (const ACE_U_LongLong &ll) const { ACE_U_LongLong ret (lo_ + ll.lo_, hi_ + ll.hi_); - ret.normalize (); - + if (ret.lo_ < ll.lo_) /* carry */ ++ret.hi_; return ret; } ACE_INLINE ACE_U_LongLong ACE_U_LongLong::operator- (const ACE_U_LongLong &ll) const { - ACE_U_LongLong ret (lo_, hi_ - ll.hi_); - - if (lo_ < ll.lo_) - { - --ret.hi_; /* borrow from hi_ */ - ret.lo_ += 1000000000; - } - ret.lo_ -= ll.lo_; - + ACE_U_LongLong ret (lo_ - ll.lo_, hi_ - ll.hi_); + if (lo_ < ll.lo_) /* borrow */ --ret.hi_; return ret; } @@ -6537,8 +6517,7 @@ ACE_U_LongLong::operator+= (const ACE_U_LongLong &ll) { hi_ += ll.hi_; lo_ += ll.lo_; - normalize (); - + if (lo_ < ll.lo_) /* carry */ ++hi_; return *this; } @@ -6546,16 +6525,10 @@ ACE_INLINE ACE_U_LongLong & ACE_U_LongLong::operator-= (const ACE_U_LongLong &ll) { hi_ -= ll.hi_; - if (lo_ < ll.lo_) - { - --hi_; /* borrow from hi_ */ - lo_ += 1000000000; - } + if (lo_ < ll.lo_) /* borrow */ --hi_; lo_ -= ll.lo_; - return *this; } - #endif /* ! ACE_WIN32 && ! ACE_HAS_LONGLONG_T */ #if !defined (ACE_HAS_PENTIUM) || !defined (__GNUC__) |