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
diff --git a/plat/juno/aarch64/juno_common.c b/plat/juno/aarch64/juno_common.c
index 6ea0b15..371323e 100644
--- a/plat/juno/aarch64/juno_common.c
+++ b/plat/juno/aarch64/juno_common.c
@@ -114,7 +114,7 @@
 };
 #endif
 
-CASSERT((sizeof(juno_mmap)/sizeof(juno_mmap[0])) + JUNO_BL_REGIONS \
+CASSERT(ARRAY_SIZE(juno_mmap) + JUNO_BL_REGIONS \
 		<= MAX_MMAP_REGIONS, assert_max_mmap_regions);
 
 /* Array of secure interrupts to be configured by the gic driver */
@@ -136,9 +136,6 @@
 	IRQ_SEC_SGI_7
 };
 
-const unsigned int num_sec_irqs = sizeof(irq_sec_array) /
-	sizeof(irq_sec_array[0]);
-
 /*******************************************************************************
  * Macro generating the code for the function setting up the pagetables as per
  * the platform memory map & initialize the mmu, for the given exception level
@@ -211,5 +208,9 @@
 
 void plat_gic_init(void)
 {
-	arm_gic_init(GICC_BASE, GICD_BASE, 0, irq_sec_array, num_sec_irqs);
+	arm_gic_init(GICC_BASE,
+		GICD_BASE,
+		0,
+		irq_sec_array,
+		ARRAY_SIZE(irq_sec_array));
 }