From 0e330f523c731699e8743d70c935d9b9bb46ed42 Mon Sep 17 00:00:00 2001 From: schmidt Date: Sun, 31 Aug 1997 21:41:05 +0000 Subject: *** empty log message *** --- ace/Handle_Set.cpp | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'ace/Handle_Set.cpp') diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp index b0000cce45f..f40b0e67578 100644 --- a/ace/Handle_Set.cpp +++ b/ace/Handle_Set.cpp @@ -79,43 +79,28 @@ ACE_Handle_Set::ACE_Handle_Set (const ACE_FD_SET_TYPE &fd_mask) // Counts the number of bits enabled in N. Uses a table lookup to // speed up the count. -#if defined (ACE_HAS_LONG_FDMASK) -// If there are platforms where fd_mask isn't typedef'd to a 4 byte -// quantify we'll have to use the following code. - int ACE_Handle_Set::count_bits (u_long n) const { - ACE_TRACE ("ACE_Handle_Set::count_bits"); - int rval = 0; + + ACE_TRACE ("ACE_Handle_Set::count_bits"); +#if defined (ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT) + register int rval = 0; while (n > 0) { -#if defined (ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT) rval++; n &= n - 1; -#else - rval += ACE_Handle_Set::nbits_[n & 0xff]; - n >>= 8; -#endif /* ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT */ } return rval; -} #else - -// Otherwise we can use the following. - -int -ACE_Handle_Set::count_bits (u_long n) const -{ - ACE_TRACE ("ACE_Handle_Set::count_bits"); - return (ACE_Handle_Set::nbits_[n & 0xff] - + ACE_Handle_Set::nbits_[(n >> 8) & 0xff] - + ACE_Handle_Set::nbits_[(n >> 16) & 0xff] - + ACE_Handle_Set::nbits_[(n >> 24) & 0xff]); + return (ACE_Handle_Set::nbits_[n & 0xff] + + ACE_Handle_Set::nbits_[(n >> 8) & 0xff] + + ACE_Handle_Set::nbits_[(n >> 16) & 0xff] + + ACE_Handle_Set::nbits_[(n >> 24) & 0xff]); +#endif /* ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT */ } -#endif /* ACE_HAS_LONG_FDMASK */ // Synchronize the underlying FD_SET with the MAX_FD and the SIZE. -- cgit v1.2.1