Fix leveldb's alignment assumptions (we have 4 byte alignment)

custom
jacqueline 2 years ago
parent 5b7b88420b
commit 4e5dba1583
  1. 2
      lib/leveldb/util/arena.cc

@ -36,7 +36,7 @@ char* Arena::AllocateFallback(size_t bytes) {
} }
char* Arena::AllocateAligned(size_t bytes) { char* Arena::AllocateAligned(size_t bytes) {
const int align = (sizeof(void*) > 8) ? sizeof(void*) : 8; const int align = 4;
static_assert((align & (align - 1)) == 0, static_assert((align & (align - 1)) == 0,
"Pointer size should be a power of 2"); "Pointer size should be a power of 2");
size_t current_mod = reinterpret_cast<uintptr_t>(alloc_ptr_) & (align - 1); size_t current_mod = reinterpret_cast<uintptr_t>(alloc_ptr_) & (align - 1);

Loading…
Cancel
Save