summaryrefslogtreecommitdiff
path: root/util/arena.cc
diff options
context:
space:
mode:
authorChris Mumford <cmumford@google.com>2019-05-02 11:01:00 -0700
committerVictor Costan <pwnall@chromium.org>2019-05-02 19:04:50 -0700
commit297e66afc1dda3f3d7a7cc2022030164c302cb7a (patch)
treec7266d464e3b361a8f580ebe1e67c128e7e2a712 /util/arena.cc
parent3724030179716fd8d95cf79339884c49afade8f9 (diff)
downloadleveldb-297e66afc1dda3f3d7a7cc2022030164c302cb7a.tar.gz
Format all files IAW the Google C++ Style Guide.
Use clang-format to correct formatting to be in agreement with the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Doing this simplifies the process of accepting changes. Also fixed a few warnings flagged by clang-tidy. PiperOrigin-RevId: 246350737
Diffstat (limited to 'util/arena.cc')
-rw-r--r--util/arena.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/util/arena.cc b/util/arena.cc
index a496ad0..eadec8a 100644
--- a/util/arena.cc
+++ b/util/arena.cc
@@ -39,8 +39,9 @@ char* Arena::AllocateFallback(size_t bytes) {
char* Arena::AllocateAligned(size_t bytes) {
const int align = (sizeof(void*) > 8) ? sizeof(void*) : 8;
- assert((align & (align-1)) == 0); // Pointer size should be a power of 2
- size_t current_mod = reinterpret_cast<uintptr_t>(alloc_ptr_) & (align-1);
+ static_assert((align & (align - 1)) == 0,
+ "Pointer size should be a power of 2");
+ size_t current_mod = reinterpret_cast<uintptr_t>(alloc_ptr_) & (align - 1);
size_t slop = (current_mod == 0 ? 0 : align - current_mod);
size_t needed = bytes + slop;
char* result;
@@ -52,7 +53,7 @@ char* Arena::AllocateAligned(size_t bytes) {
// AllocateFallback always returned aligned memory
result = AllocateFallback(bytes);
}
- assert((reinterpret_cast<uintptr_t>(result) & (align-1)) == 0);
+ assert((reinterpret_cast<uintptr_t>(result) & (align - 1)) == 0);
return result;
}