Skip to content

Commit

Permalink
os/bluestore/BitmapFreelistManager: readability improvements
Browse files Browse the repository at this point in the history
Be slightly nice to who is looking at get_next_clear[set]_bit().

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
xiexingguo committed Jan 11, 2017
1 parent 573918b commit 28b0011
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/os/bluestore/BitmapFreelistManager.cc
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 28b0011

Please sign in to comment.