diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-16 03:29:30 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-16 09:58:11 -0800 |
commit | dc1685ca25567fe75c8d50c825fb0303fbb66fac (patch) | |
tree | e51e63fe1e40d3c60673f57784f88c43277f5eba /src/jtag | |
parent | 10cce4a5fe85bfd680bc338c900b0033d7174b6a (diff) |
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).
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/core.c | 2 | ||||
-rw-r--r-- | src/jtag/interface.c | 4 | ||||
-rw-r--r-- | src/jtag/jtag.h | 8 |
3 files changed, 3 insertions, 11 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c index c8a76e88..ea723ebe 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -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) { diff --git a/src/jtag/interface.c b/src/jtag/interface.c index f0624142..1ed45123 100644 --- a/src/jtag/interface.c +++ b/src/jtag/interface.c @@ -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; diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index ee3ca32b..d4fafa3b 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -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>-------------------------------------------------*/ /** |