From 13a590ca65f744c8fa55d6e0748cb12f443493f0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 13 Feb 2017 00:12:35 -0500 Subject: sim: use ARRAY_SIZE instead of ad-hoc sizeof calculations --- sim/sh/gencode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sim/sh/gencode.c') 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 #include #include +#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) + -- cgit v1.1