From a7e98ad5145bb57fd18d199f915c76ef376cf227 Mon Sep 17 00:00:00 2001 From: Vikram Kanigiri Date: Wed, 4 Mar 2015 10:34:27 +0000 Subject: Add macro to calculate number of elements in an array This patch defines the ARRAY_SIZE macro for calculating number of elements in an array and uses it where appropriate. Change-Id: I72746a9229f0b259323972b498b9a3999731bc9b --- lib/aarch64/xlat_tables.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/aarch64/xlat_tables.c b/lib/aarch64/xlat_tables.c index ddc9ba88..fa1a03da 100644 --- a/lib/aarch64/xlat_tables.c +++ b/lib/aarch64/xlat_tables.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -89,7 +90,7 @@ void mmap_add_region(unsigned long base_pa, unsigned long base_va, unsigned long size, unsigned attr) { mmap_region_t *mm = mmap; - mmap_region_t *mm_last = mm + sizeof(mmap) / sizeof(mmap[0]) - 1; + mmap_region_t *mm_last = mm + ARRAY_SIZE(mmap) - 1; unsigned long pa_end = base_pa + size - 1; unsigned long va_end = base_va + size - 1; -- cgit