diff options
author | Mike Frysinger <vapier@gentoo.org> | 2017-02-13 00:12:35 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2017-02-13 01:26:21 -0500 |
commit | 13a590ca65f744c8fa55d6e0748cb12f443493f0 (patch) | |
tree | 0aaec23ac3d6682a00d7af03dbef8e790c47b681 /sim/sh | |
parent | b1499fc214c2877ba76d7dffd4c41e33f3ec37f6 (diff) | |
download | binutils-13a590ca65f744c8fa55d6e0748cb12f443493f0.zip binutils-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.gz binutils-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.bz2 |
sim: use ARRAY_SIZE instead of ad-hoc sizeof calculations
Diffstat (limited to 'sim/sh')
-rw-r--r-- | sim/sh/ChangeLog | 6 | ||||
-rw-r--r-- | sim/sh/gencode.c | 7 | ||||
-rw-r--r-- | sim/sh/interp.c | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 9d3cf44..6430e6d 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,9 @@ +2017-02-13 Mike Frysinger <vapier@gentoo.org> + + * gencode.c: Include libiberty.h. + (conflict_warn): Use ARRAY_SIZE. + * interp.c (init_dsp): Likewise. + 2016-04-10 Oleg Endo <olegendo@gcc.gnu.org> * interp.c (dmul): Split into dmul_s and dmul_u. Use explicit integer diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c index 2f1a3f5..77a83d6 100644 --- a/sim/sh/gencode.c +++ b/sim/sh/gencode.c @@ -35,6 +35,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "libiberty.h" #define MAX_NR_STUFF 42 @@ -2595,7 +2596,7 @@ conflict_warn (int val, int i) fprintf (stderr, "Warning: opcode table conflict: 0x%04x (idx %d && %d)\n", val, i, table[val]); - for (ix = sizeof (tab) / sizeof (tab[0]); ix >= 0; ix--) + for (ix = ARRAY_SIZE (tab); ix >= 0; ix--) if (tab[ix].index == i || tab[ix].index == j) { key = ((tab[ix].code[0] - '0') << 3) + @@ -2607,7 +2608,7 @@ conflict_warn (int val, int i) fprintf (stderr, " %s -- %s\n", tab[ix].code, tab[ix].name); } - for (ix = sizeof (movsxy_tab) / sizeof (movsxy_tab[0]); ix >= 0; ix--) + for (ix = ARRAY_SIZE (movsxy_tab); ix >= 0; ix--) if (movsxy_tab[ix].index == i || movsxy_tab[ix].index == j) { key = ((movsxy_tab[ix].code[0] - '0') << 3) + @@ -2620,7 +2621,7 @@ conflict_warn (int val, int i) movsxy_tab[ix].code, movsxy_tab[ix].name); } - for (ix = sizeof (ppi_tab) / sizeof (ppi_tab[0]); ix >= 0; ix--) + for (ix = ARRAY_SIZE (ppi_tab); ix >= 0; ix--) if (ppi_tab[ix].index == i || ppi_tab[ix].index == j) { key = ((ppi_tab[ix].code[0] - '0') << 3) + diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 32618ba..c77cf3b 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -1658,7 +1658,7 @@ init_dsp (struct bfd *abfd) { int i, tmp; - for (i = (sizeof sh_dsp_table / sizeof sh_dsp_table[0]) - 1; i >= 0; i--) + for (i = ARRAY_SIZE (sh_dsp_table) - 1; i >= 0; i--) { tmp = sh_jump_table[0xf000 + i]; sh_jump_table[0xf000 + i] = sh_dsp_table[i]; |