]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Start using the new, unambiguous and consistent bit functions
authorVMware, Inc <>
Thu, 17 Jun 2010 21:20:49 +0000 (14:20 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:20:49 +0000 (14:20 -0700)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/misc/hashTable.c

index d7758f92e6209e4da27387ac5985ef6b89f2c7c4..69b0148afeb66289882ae8770b7bb422b94e78a8 100644 (file)
@@ -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;