]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/bluestore/BitmapFreelistManager.cc
update sources to v12.1.3
[ceph.git] / ceph / src / os / bluestore / BitmapFreelistManager.cc
index d3fdbb71a8da7942fdd03576227f23c69897971f..075d3eff6ef18451c6ba04cdd41463ad6cbc0ee6 100644 (file)
@@ -191,10 +191,10 @@ int get_next_clear_bit(bufferlist& bl, int start)
   const char *p = bl.c_str();
   int bits = bl.length() << 3;
   while (start < bits) {
-    int which_byte = start / 8;
-    int which_bit = start % 8;
-    unsigned char byte_mask = 1 << which_bit;
-    if ((p[which_byte] & byte_mask) == 0) {
+    // byte = start / 8 (or start >> 3)
+    // bit = start % 8 (or start & 7)
+    unsigned char byte_mask = 1 << (start & 7);
+    if ((p[start >> 3] & byte_mask) == 0) {
       return start;
     }
     ++start;