summaryrefslogtreecommitdiff
path: root/ace/Handle_Set.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-06-21 17:34:12 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-06-21 17:34:12 +0000
commitd6d266b2f42bdc2ef1ddfaca63964232237fbe35 (patch)
tree7ee50866e301f7bdca0c4df3ddfd22a898e5d6a0 /ace/Handle_Set.cpp
parentefb6d8efd41ff7464360910602e74d013151c727 (diff)
downloadATCD-d6d266b2f42bdc2ef1ddfaca63964232237fbe35.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/Handle_Set.cpp')
-rw-r--r--ace/Handle_Set.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp
index b09333d144e..e146368ca07 100644
--- a/ace/Handle_Set.cpp
+++ b/ace/Handle_Set.cpp
@@ -78,6 +78,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 0
+// If there are platforms where fd_mask isn't typedef'd to "int" we'll
+// have to use the following code. OS_FDMASK_TYPE is set in the
+// config*.h file to match whatever the OS has decided it should be.
+// For the Alpha, that is "int", for Linux it is "u_long."
+
+int
+ACE_Handle_Set::count_bits (OS_FDMASK_TYPE n) const
+{
+ ACE_TRACE ("ACE_Handle_Set::count_bits");
+ int rval = 0;
+
+ for (int i = 0; i < sizeof (u_long); ++i)
+ {
+ rval += ACE_Handle_Set::nbits_[n & 0xff];
+ n >>= 8;
+ }
+
+ return rval;
+}
+#endif /* 0 */
+
int
ACE_Handle_Set::count_bits (u_long n) const
{
@@ -85,7 +107,7 @@ ACE_Handle_Set::count_bits (u_long n) const
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]);
+ + ACE_Handle_Set::nbits_[(n >> 24) & 0xff]);
}
// Synchronize the underlying FD_SET with the MAX_FD and the SIZE.