From f2b20f8804f97fdfca901925f13869e509473fcc Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 9 Nov 2014 14:47:39 -0600 Subject: [PATCH] SupportDef: Add B_COUNT_OF to get array element count. * We implement this in a lot of places in a lot of ways. Lets add it to the SupportDef --- headers/os/support/SupportDefs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index 7e47018178..e4f6293b3a 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -202,6 +202,9 @@ extern void* get_stack_frame(void); } #endif +/* Count items in an array, count_of is a common define */ +#define B_COUNT_OF(a) (sizeof(a) / sizeof(a[0])) + /* Obsolete or discouraged API */ /* use 'true' and 'false' */