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:
@@ -586,7 +586,7 @@ int jtag_add_statemove(tap_state_t goal_state)
|
||||
unsigned tms_bits = tap_get_tms_path(cur_state, goal_state);
|
||||
unsigned tms_count = tap_get_tms_path_len(cur_state, goal_state);
|
||||
tap_state_t moves[8];
|
||||
assert(tms_count < DIM(moves));
|
||||
assert(tms_count < ARRAY_SIZE(moves));
|
||||
|
||||
for (unsigned i = 0; i < tms_count; i++, tms_bits >>= 1)
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ const char *tap_state_name(tap_state_t state)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < DIM(tap_name_mapping); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
|
||||
if (tap_name_mapping[i].symbol == state)
|
||||
return tap_name_mapping[i].name;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ tap_state_t tap_state_by_name(const char *name)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < DIM(tap_name_mapping); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(tap_name_mapping); i++) {
|
||||
/* be nice to the human */
|
||||
if (strcasecmp(name, tap_name_mapping[i].name) == 0)
|
||||
return tap_name_mapping[i].symbol;
|
||||
|
||||
@@ -38,14 +38,6 @@
|
||||
#define DEBUG_JTAG_IOZ 64
|
||||
#endif
|
||||
|
||||
/*-----<Macros>--------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* When given an array, compute its DIMension; in other words, the
|
||||
* number of elements in the array
|
||||
*/
|
||||
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/*-----</Macros>-------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user