move ARRAY_SIZE macro to types.h
The ARRAY_SIZE macro was defined in several target files, so move it to types.h. This patch also removes two other identical macros: DIM (from jtag.h) and asizeof (from arm11.h).
This commit is contained in:
@@ -60,6 +60,16 @@ typedef bool _Bool;
|
||||
#define __stringify(s) #s
|
||||
|
||||
|
||||
/**
|
||||
* Compute the number of elements of a variable length array.
|
||||
* <code>
|
||||
* const char *strs[] = { "a", "b", "c" };
|
||||
* unsigned num_strs = ARRAY_SIZE(strs);
|
||||
* </code>
|
||||
*/
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
|
||||
/**
|
||||
* Cast a member of a structure out to the containing structure.
|
||||
* @param ptr The pointer to the member.
|
||||
|
||||
Reference in New Issue
Block a user