Fixed non-debug build warning

pull/18875/head
Arjun Roy 6 years ago
parent a3fe7c0c90
commit e1a96b8347
  1. 2
      src/core/lib/gpr/alloc.cc
  2. 4
      src/core/lib/gprpp/arena.cc

@ -34,12 +34,14 @@ static void* zalloc_with_gpr_malloc(size_t sz) {
return p; return p;
} }
#ifndef NDEBUG
static constexpr bool is_power_of_two(size_t value) { static constexpr bool is_power_of_two(size_t value) {
// 2^N = 100000...000 // 2^N = 100000...000
// 2^N - 1 = 011111...111 // 2^N - 1 = 011111...111
// (2^N) && ((2^N)-1)) = 0 // (2^N) && ((2^N)-1)) = 0
return (value & (value - 1)) == 0; return (value & (value - 1)) == 0;
} }
#endif
static void* aligned_alloc_with_gpr_malloc(size_t size, size_t alignment) { static void* aligned_alloc_with_gpr_malloc(size_t size, size_t alignment) {
GPR_DEBUG_ASSERT(is_power_of_two(alignment)); GPR_DEBUG_ASSERT(is_power_of_two(alignment));

@ -35,8 +35,8 @@ namespace {
void* ArenaStorage(size_t initial_size) { void* ArenaStorage(size_t initial_size) {
static constexpr size_t base_size = static constexpr size_t base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_core::Arena)); GPR_ROUND_UP_TO_MAX_ALIGNMENT_SIZE(sizeof(grpc_core::Arena));
initial_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_size); initial_size = GPR_ROUND_UP_TO_MAX_ALIGNMENT_SIZE(initial_size);
size_t alloc_size = base_size + initial_size; size_t alloc_size = base_size + initial_size;
static constexpr size_t alignment = static constexpr size_t alignment =
(GPR_CACHELINE_SIZE > GPR_MAX_ALIGNMENT && (GPR_CACHELINE_SIZE > GPR_MAX_ALIGNMENT &&

Loading…
Cancel
Save