diff --git a/table/block_based_table_builder.cc b/table/block_based_table_builder.cc index 6545c7b8f2..7841593395 100644 --- a/table/block_based_table_builder.cc +++ b/table/block_based_table_builder.cc @@ -81,9 +81,9 @@ FilterBlockBuilder* CreateFilterBlockBuilder( // as partition size. assert(table_opt.block_size_deviation <= 100); auto partition_size = - (const uint32_t)(table_opt.metadata_block_size * - (100 - table_opt.block_size_deviation)); - partition_size = std::max(partition_size, (const uint32_t)1); + static_cast(table_opt.metadata_block_size * + (100 - table_opt.block_size_deviation)); + partition_size = std::max(partition_size, static_cast(1)); return new PartitionedFilterBlockBuilder( opt.prefix_extractor, table_opt.whole_key_filtering, filter_bits_builder, table_opt.index_block_restart_interval, diff --git a/table/partitioned_filter_block_test.cc b/table/partitioned_filter_block_test.cc index 288a75a950..352b2d7233 100644 --- a/table/partitioned_filter_block_test.cc +++ b/table/partitioned_filter_block_test.cc @@ -89,12 +89,10 @@ class PartitionedFilterBlockTest : public testing::Test { PartitionedFilterBlockBuilder* NewBuilder( PartitionedIndexBuilder* const p_index_builder) { - uint32_t partition_size = - table_options_.metadata_block_size > - (uint64_t)table_options_.block_size_deviation - ? table_options_.metadata_block_size - - table_options_.block_size_deviation - : 1; + assert(table_opt.block_size_deviation <= 100); + auto partition_size = static_cast( + table_opt.metadata_block_size * (100 - table_opt.block_size_deviation)); + partition_size = std::max(partition_size, static_cast(1)); return new PartitionedFilterBlockBuilder( nullptr, table_options_.whole_key_filtering, table_options_.filter_policy->GetFilterBitsBuilder(),