diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-08-30 21:43:06 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-08-30 21:43:06 +0000 |
commit | bcdbb84f6e916d82dae91dcab38ffc01389d1dc4 (patch) | |
tree | 68f38ce76cc098cb0aa795700501c5eb1068c026 /ace/Handle_Set.cpp | |
parent | 6a4d079a1330b91c50af8909ddd673f65e667fec (diff) | |
download | ATCD-bcdbb84f6e916d82dae91dcab38ffc01389d1dc4.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/Handle_Set.cpp')
-rw-r--r-- | ace/Handle_Set.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp index ce5ce1af3fa..b0000cce45f 100644 --- a/ace/Handle_Set.cpp +++ b/ace/Handle_Set.cpp @@ -80,8 +80,8 @@ ACE_Handle_Set::ACE_Handle_Set (const ACE_FD_SET_TYPE &fd_mask) // speed up the count. #if defined (ACE_HAS_LONG_FDMASK) -// If there are platforms where fd_mask isn't typedef'd to "int" we'll -// have to use the following code. +// 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 @@ -89,16 +89,23 @@ ACE_Handle_Set::count_bits (u_long n) const ACE_TRACE ("ACE_Handle_Set::count_bits"); int rval = 0; - for (int i = 0; n != 0; i++) + 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 { |