From: VMware, Inc <> Date: Thu, 17 Jun 2010 21:20:49 +0000 (-0700) Subject: Start using the new, unambiguous and consistent bit functions X-Git-Tag: 2010.06.16-268169~140 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ca6ca71cbe60497de0a6fbcf111e02835fd9836c;p=thirdparty%2Fopen-vm-tools.git Start using the new, unambiguous and consistent bit functions Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/misc/hashTable.c b/open-vm-tools/lib/misc/hashTable.c index d7758f92e..69b0148af 100644 --- a/open-vm-tools/lib/misc/hashTable.c +++ b/open-vm-tools/lib/misc/hashTable.c @@ -182,25 +182,6 @@ strcasecmp(const char *s1, // IN: return tolower(*s1) - tolower(*s2); } - -static int -ffs(uint32 bits) -{ - uint32 i; - - if (bits == 0) { - i = 0; - } else { - i = 1; - - while ((bits & 0x1) == 0) { - i++; - bits >>= 1; - } - } - - return i; -} #endif @@ -275,7 +256,7 @@ HashTable_Alloc(uint32 numEntries, // IN: must be a power of 2 ht = Util_SafeMalloc(sizeof *ht); ASSERT_MEM_ALLOC(ht); - ht->numBits = ffs(numEntries) - 1; + ht->numBits = lssb32_0(numEntries); ht->numEntries = numEntries; ht->keyType = keyType & HASH_TYPE_MASK; ht->atomic = (keyType & HASH_FLAG_ATOMIC) != 0;