]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BitmapFreelistManager: readability improvements
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 11 Jan 2017 03:44:30 +0000 (11:44 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 11 Jan 2017 03:50:13 +0000 (11:50 +0800)
Be slightly nice to who is looking at get_next_clear[set]_bit().

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BitmapFreelistManager.cc

index d6f41f5a33a303d95b1e5e6a2b3ecf9d27be2ea5..303f33ae899995ef1e9937aa1b13499f2391f628 100644 (file)
@@ -189,9 +189,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 byte = start >> 3;
-    unsigned char mask = 1 << (start & 7);
-    if ((p[byte] & mask) == 0) {
+    int which_byte = start / 8;
+    int which_bit = start % 8;
+    unsigned char byte_mask = 1 << which_bit;
+    if ((p[which_byte] & byte_mask) == 0) {
       return start;
     }
     ++start;
@@ -204,9 +205,10 @@ int get_next_set_bit(bufferlist& bl, int start)
   const char *p = bl.c_str();
   int bits = bl.length() << 3;
   while (start < bits) {
-    int byte = start >> 3;
-    unsigned char mask = 1 << (start & 7);
-    if (p[byte] & mask) {
+    int which_byte = start / 8;
+    int which_bit = start % 8;
+    unsigned char byte_mask = 1 << which_bit;
+    if (p[which_byte] & byte_mask) {
       return start;
     }
     ++start;