sim: testsuite: migrate to standard uintXX_t types

This old code setup its own uintXX types, but since we require C11
now, we can assume the standard uintXX_t types exist and use them.
This commit is contained in:
Mike Frysinger
2021-12-05 12:32:34 -05:00
parent 4a92dedc59
commit 39a5fdbc65
4 changed files with 19 additions and 19 deletions

View File

@ -5,7 +5,7 @@
#include "symcat.h" #include "symcat.h"
/* NOTE: see end of file for #undef of these macros */ /* NOTE: see end of file for #undef of these macros */
#define unsignedN XCONCAT2(unsigned,N) #define unsignedN XCONCAT3(uint,N,_t)
#define MAX_INT XCONCAT2(MAX_INT,N) #define MAX_INT XCONCAT2(MAX_INT,N)
#define MIN_INT XCONCAT2(MIN_INT,N) #define MIN_INT XCONCAT2(MIN_INT,N)
#define alu_N_tests XCONCAT3(alu_,N,_tests) #define alu_N_tests XCONCAT3(alu_,N,_tests)

View File

@ -27,13 +27,13 @@
typedef struct { typedef struct {
char *op; char *op;
unsigned64 arg; uint64_t arg;
} alu_op; } alu_op;
typedef struct { typedef struct {
unsigned64 begin; uint64_t begin;
alu_op ops[4]; alu_op ops[4];
unsigned64 result; uint64_t result;
int carry_borrow; int carry_borrow;
int overflow; int overflow;
} alu_test; } alu_test;
@ -51,21 +51,21 @@ typedef struct {
#define MIN_INT64 UNSIGNED64 (0x8000000000000000) #define MIN_INT64 UNSIGNED64 (0x8000000000000000)
static void static void
print_hex (unsigned64 val, int nr_bits) print_hex (uint64_t val, int nr_bits)
{ {
switch (nr_bits) switch (nr_bits)
{ {
case 8: case 8:
printf ("0x%02lx", (long) (unsigned8) (val)); printf ("0x%02lx", (long) (uint8_t) (val));
break; break;
case 16: case 16:
printf ("0x%04lx", (long) (unsigned16) (val)); printf ("0x%04lx", (long) (uint16_t) (val));
break; break;
case 32: case 32:
printf ("0x%08lx", (long) (unsigned32) (val)); printf ("0x%08lx", (long) (uint32_t) (val));
break; break;
case 64: case 64:
printf ("0x%016llx", (long long) (unsigned64) (val)); printf ("0x%016llx", (long long) (uint64_t) (val));
break; break;
default: default:
abort (); abort ();

View File

@ -30,8 +30,8 @@ gen_struct (void)
printf (" int line;\n"); printf (" int line;\n");
printf (" int row;\n"); printf (" int row;\n");
printf (" int col;\n"); printf (" int col;\n");
printf (" unsigned64 val;\n"); printf (" uint64_t val;\n");
printf (" unsigned64 check;\n"); printf (" uint64_t check;\n");
printf ("} test_tuples;\n"); printf ("} test_tuples;\n");
printf ("\n"); printf ("\n");
printf ("typedef struct _test_spec {\n"); printf ("typedef struct _test_spec {\n");

View File

@ -25,7 +25,7 @@ do { \
static int flags; static int flags;
int8 int8_t
syst_float_flags_clear () syst_float_flags_clear ()
{ {
int old_flags = 0; int old_flags = 0;
@ -72,7 +72,7 @@ syst_float_flags_clear ()
sim_fpu_round rounding_mode; sim_fpu_round rounding_mode;
void void
syst_float_set_rounding_mode(int8 mode) syst_float_set_rounding_mode(int8_t mode)
{ {
switch (mode) switch (mode)
{ {
@ -93,7 +93,7 @@ syst_float_set_rounding_mode(int8 mode)
float32 float32
syst_int32_to_float32(int32 a) syst_int32_to_float32(int32_t a)
{ {
float32 z; float32 z;
sim_fpu s; sim_fpu s;
@ -104,7 +104,7 @@ syst_int32_to_float32(int32 a)
} }
float64 float64
syst_int32_to_float64( int32 a ) syst_int32_to_float64( int32_t a )
{ {
float64 z; float64 z;
sim_fpu s; sim_fpu s;
@ -113,10 +113,10 @@ syst_int32_to_float64( int32 a )
return z; return z;
} }
int32 int32_t
syst_float32_to_int32_round_to_zero( float32 a ) syst_float32_to_int32_round_to_zero( float32 a )
{ {
int32 z; int32_t z;
sim_fpu s; sim_fpu s;
sim_fpu_32to (&s, a); sim_fpu_32to (&s, a);
flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero); flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero);
@ -312,9 +312,9 @@ flag syst_float32_lt_quiet( float32 a, float32 b )
return is; return is;
} }
int32 syst_float64_to_int32_round_to_zero( float64 a ) int32_t syst_float64_to_int32_round_to_zero( float64 a )
{ {
int32 z; int32_t z;
sim_fpu s; sim_fpu s;
sim_fpu_64to (&s, a); sim_fpu_64to (&s, a);
flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero); flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero);