提交 9d501932 编写于 作者: Y Yueh-Hsuan Chiang

Replace log2 by implementing Log2 in options_builder

Summary:
log2 function is only used in options_builder, and this function
is not available under certain platform such as android.
This patch implements Log2 by log(n) / log(2).

Test Plan:
make
上级 274ba627
......@@ -11,6 +11,10 @@ namespace rocksdb {
namespace {
double Log2(double n) {
return log(n) / log(2);
}
// For now, always use 1-0 as level bytes multiplier.
const int kBytesForLevelMultiplier = 10;
const size_t kBytesForOneMb = 1024 * 1024;
......@@ -28,7 +32,7 @@ CompactionStyle PickCompactionStyle(size_t write_buffer_size,
::log(target_db_size / write_buffer_size) / ::log(kBytesForLevelMultiplier)));
int expected_max_files_universal =
static_cast<int>(ceil(log2(target_db_size / write_buffer_size)));
static_cast<int>(ceil(Log2(target_db_size / write_buffer_size)));
const int kEstimatedLevel0FilesInLevelStyle = 2;
// Estimate write amplification:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册