diff --git a/src/core/lib/gpr/alloc.cc b/src/core/lib/gpr/alloc.cc index 0d9f6f7120e..b12b7d8534d 100644 --- a/src/core/lib/gpr/alloc.cc +++ b/src/core/lib/gpr/alloc.cc @@ -34,12 +34,14 @@ static void* zalloc_with_gpr_malloc(size_t sz) { return p; } +#ifndef NDEBUG static constexpr bool is_power_of_two(size_t value) { // 2^N = 100000...000 // 2^N - 1 = 011111...111 // (2^N) && ((2^N)-1)) = 0 return (value & (value - 1)) == 0; } +#endif static void* aligned_alloc_with_gpr_malloc(size_t size, size_t alignment) { GPR_DEBUG_ASSERT(is_power_of_two(alignment)); diff --git a/src/core/lib/gprpp/arena.cc b/src/core/lib/gprpp/arena.cc index e1c7b292f8c..2623ae870a1 100644 --- a/src/core/lib/gprpp/arena.cc +++ b/src/core/lib/gprpp/arena.cc @@ -35,8 +35,8 @@ namespace { void* ArenaStorage(size_t initial_size) { static constexpr size_t base_size = - GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_core::Arena)); - initial_size = GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_size); + GPR_ROUND_UP_TO_MAX_ALIGNMENT_SIZE(sizeof(grpc_core::Arena)); + initial_size = GPR_ROUND_UP_TO_MAX_ALIGNMENT_SIZE(initial_size); size_t alloc_size = base_size + initial_size; static constexpr size_t alignment = (GPR_CACHELINE_SIZE > GPR_MAX_ALIGNMENT &&