diff options
author | xie xingguo <xie.xingguo@zte.com.cn> | 2017-01-11 04:44:30 +0100 |
---|---|---|
committer | xie xingguo <xie.xingguo@zte.com.cn> | 2017-01-11 04:50:13 +0100 |
commit | ea5d71cabc0017df66900f916f237060d60457a6 (patch) | |
tree | 8109b7d33818be3cf510743a767a570b2c534026 /src/os/bluestore/BitmapFreelistManager.cc | |
parent | os/bluestore/BitmapFreelistManager: formatting nits (diff) | |
download | ceph-ea5d71cabc0017df66900f916f237060d60457a6.tar.xz ceph-ea5d71cabc0017df66900f916f237060d60457a6.zip |
os/bluestore/BitmapFreelistManager: readability improvements
Be slightly nice to who is looking at get_next_clear[set]_bit().
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
Diffstat (limited to 'src/os/bluestore/BitmapFreelistManager.cc')
-rw-r--r-- | src/os/bluestore/BitmapFreelistManager.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/os/bluestore/BitmapFreelistManager.cc b/src/os/bluestore/BitmapFreelistManager.cc index d6f41f5a33a..303f33ae899 100644 --- a/src/os/bluestore/BitmapFreelistManager.cc +++ b/src/os/bluestore/BitmapFreelistManager.cc @@ -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; |