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/gencode.c | |
parent | b1499fc214c2877ba76d7dffd4c41e33f3ec37f6 (diff) | |
download | fsf-binutils-gdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.zip fsf-binutils-gdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.gz fsf-binutils-gdb-13a590ca65f744c8fa55d6e0748cb12f443493f0.tar.bz2 |
sim: use ARRAY_SIZE instead of ad-hoc sizeof calculations
Diffstat (limited to 'sim/sh/gencode.c')
-rw-r--r-- | sim/sh/gencode.c | 7 |
1 files changed, 4 insertions, 3 deletions
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) + |