1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 00:27:39 +01:00

Use shared `ARRAY_SIZE' in IA64 tests

This commit is contained in:
Tommi Rantala 2012-09-19 14:39:33 +03:00
parent 6b55e0ab51
commit 2fbbf276b3
2 changed files with 6 additions and 8 deletions

View file

@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <string.h> #include <string.h>
#include <libunwind.h> #include <libunwind.h>
#include "compiler.h"
#ifdef HAVE_SYS_UC_ACCESS_H #ifdef HAVE_SYS_UC_ACCESS_H
# include <sys/uc_access.h> # include <sys/uc_access.h>
@ -38,8 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "tdep-ia64/rse.h" #include "tdep-ia64/rse.h"
#define ARRAY_SIZE(a) ((int) (sizeof (a) / sizeof ((a)[0])))
#define NUM_RUNS 1024 #define NUM_RUNS 1024
//#define NUM_RUNS 1 //#define NUM_RUNS 1
#define MAX_CHECKS 1024 #define MAX_CHECKS 1024
@ -588,9 +587,9 @@ run_check (int test)
{ {
if (test == 1) if (test == 1)
/* Make first test once go through each test... */ /* Make first test once go through each test... */
index = i % ARRAY_SIZE (all_funcs); index = i % (int) ARRAY_SIZE (all_funcs);
else else
index = random () % ARRAY_SIZE (all_funcs); index = random () % (int) ARRAY_SIZE (all_funcs);
funcs[i] = all_funcs[index].func; funcs[i] = all_funcs[index].func;
checks[i] = all_funcs[index].check; checks[i] = all_funcs[index].check;
} }

View file

@ -32,14 +32,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h> #include <stdlib.h>
#include <libunwind.h> #include <libunwind.h>
#include "compiler.h"
#include "ia64-test-rbs.h" #include "ia64-test-rbs.h"
#define panic(args...) \ #define panic(args...) \
do { fprintf (stderr, args); ++nerrors; return -9999; } while (0) do { fprintf (stderr, args); ++nerrors; return -9999; } while (0)
#define ARRAY_SIZE(a) ((int) (sizeof (a) / sizeof ((a)[0])))
/* The loadrs field in ar.rsc is 14 bits wide, which limits all ia64 /* The loadrs field in ar.rsc is 14 bits wide, which limits all ia64
implementations to at most 2048 physical stacked registers implementations to at most 2048 physical stacked registers
(actually, slightly less than that, because loadrs also counts RNaT (actually, slightly less than that, because loadrs also counts RNaT
@ -138,7 +137,7 @@ run_check (int test)
/* First, generate a set of 88 random values which loadup() will load /* First, generate a set of 88 random values which loadup() will load
into loc2-loc89 (r37-r124). */ into loc2-loc89 (r37-r124). */
for (i = 0; i < ARRAY_SIZE (reg_values); ++i) for (i = 0; i < (int) ARRAY_SIZE (reg_values); ++i)
{ {
reg_values[i] = random (); reg_values[i] = random ();
/* Generate NaTs with a reasonably probability (1/16th): */ /* Generate NaTs with a reasonably probability (1/16th): */
@ -150,7 +149,7 @@ run_check (int test)
nfuncs = 0; nfuncs = 0;
do do
{ {
n = random () % ARRAY_SIZE (spill_funcs); n = random () % (int) ARRAY_SIZE (spill_funcs);
func[nfuncs++] = spill_funcs[n]; func[nfuncs++] = spill_funcs[n];
nspills += 2 + n; nspills += 2 + n;
} }