]> git.proxmox.com Git - qemu.git/blobdiff - util/bitops.c
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
[qemu.git] / util / bitops.c
index 4c3a836a014a615a516253c4bbfde5bed51758f7..e72237ab2b34fe7ef038ae80f2e2546fedf2e063 100644 (file)
@@ -60,7 +60,7 @@ found_first:
         return result + size;  /* Nope. */
     }
 found_middle:
-    return result + bitops_ffsl(tmp);
+    return result + ctzl(tmp);
 }
 
 /*
@@ -109,7 +109,7 @@ found_first:
         return result + size;  /* Nope. */
     }
 found_middle:
-    return result + ffz(tmp);
+    return result + ctzl(~tmp);
 }
 
 unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
@@ -133,7 +133,7 @@ unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
         tmp = addr[--words];
         if (tmp) {
         found:
-            return words * BITS_PER_LONG + bitops_flsl(tmp);
+            return words * BITS_PER_LONG + BITS_PER_LONG - 1 - clzl(tmp);
         }
     }