mirror of
https://github.com/ceph/ceph
synced 2025-01-10 13:10:46 +00:00
os/bluestore: use std::countl_zero() when appropriate
prefer the facilities provided by standard library over the homebrew ones for better readability and maintainability. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
dc92dfc9c3
commit
e132be7ee5
@ -2,6 +2,7 @@
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
|
||||
#include "Allocator.h"
|
||||
#include <bit>
|
||||
#include "StupidAllocator.h"
|
||||
#include "BitmapAllocator.h"
|
||||
#include "AvlAllocator.h"
|
||||
@ -194,7 +195,7 @@ double Allocator::get_fragmentation_score()
|
||||
size_t sum = 0;
|
||||
|
||||
auto get_score = [&](size_t v) -> double {
|
||||
size_t sc = sizeof(v) * 8 - clz(v) - 1; //assign to grade depending on log2(len)
|
||||
size_t sc = sizeof(v) * 8 - std::countl_zero(v) - 1; //assign to grade depending on log2(len)
|
||||
while (scales.size() <= sc + 1) {
|
||||
//unlikely expand scales vector
|
||||
scales.push_back(scales[scales.size() - 1] * double_size_worth);
|
||||
|
Loading…
Reference in New Issue
Block a user