summaryrefslogtreecommitdiffstats
path: root/libmemunreachable
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-06-28 14:48:45 -0700
committerElliott Hughes <enh@google.com>2016-06-28 14:48:45 -0700
commit749ae2d32f81301a2f998cf09d7a7d67aefd4104 (patch)
tree7b3c43a72cde1d68c5516c3c8ba424a01f09f567 /libmemunreachable
parent54c121962bdf68c7c66724159260c926ce58e351 (diff)
downloadcore-749ae2d32f81301a2f998cf09d7a7d67aefd4104.tar.gz
core-749ae2d32f81301a2f998cf09d7a7d67aefd4104.tar.bz2
core-749ae2d32f81301a2f998cf09d7a7d67aefd4104.zip
Remove unnecessary ARRAY_SIZE macros.
Use the canonical one instead. Change-Id: Id80f19455f37fd2a29d9ec4191c1a0af80c5c0e7
Diffstat (limited to 'libmemunreachable')
-rw-r--r--libmemunreachable/Allocator.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/libmemunreachable/Allocator.cpp b/libmemunreachable/Allocator.cpp
index 68f654c29..6fe67a41f 100644
--- a/libmemunreachable/Allocator.cpp
+++ b/libmemunreachable/Allocator.cpp
@@ -52,8 +52,6 @@ constexpr unsigned int div_round_up(unsigned int x, unsigned int y) {
return (x + y - 1) / y;
}
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
-
static constexpr size_t kPageSize = 4096;
static constexpr size_t kChunkSize = 256 * 1024;
static constexpr size_t kUsableChunkSize = kChunkSize - kPageSize;
@@ -258,7 +256,7 @@ void* Chunk::Alloc() {
unsigned int i = first_free_bitmap_;
while (free_bitmap_[i] == 0)
i++;
- assert(i < ARRAY_SIZE(free_bitmap_));
+ assert(i < arraysize(free_bitmap_));
unsigned int bit = __builtin_ffs(free_bitmap_[i]) - 1;
assert(free_bitmap_[i] & (1U << bit));
free_bitmap_[i] &= ~(1U << bit);
@@ -266,7 +264,7 @@ void* Chunk::Alloc() {
assert(n < max_allocations_);
unsigned int page = n * allocation_size_ / kPageSize;
- assert(page / 32 < ARRAY_SIZE(dirty_pages_));
+ assert(page / 32 < arraysize(dirty_pages_));
dirty_pages_[page / 32] |= 1U << (page % 32);
free_count_--;
@@ -285,7 +283,7 @@ void Chunk::Free(void* ptr) {
unsigned int i = n / 32;
unsigned int bit = n % 32;
- assert(i < ARRAY_SIZE(free_bitmap_));
+ assert(i < arraysize(free_bitmap_));
assert(!(free_bitmap_[i] & (1U << bit)));
free_bitmap_[i] |= 1U << bit;
free_count_++;