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"
/* 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 MIN_INT XCONCAT2(MIN_INT,N)
#define alu_N_tests XCONCAT3(alu_,N,_tests)

View File

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

View File

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

View File

@ -25,7 +25,7 @@ do { \
static int flags;
int8
int8_t
syst_float_flags_clear ()
{
int old_flags = 0;
@ -72,7 +72,7 @@ syst_float_flags_clear ()
sim_fpu_round rounding_mode;
void
syst_float_set_rounding_mode(int8 mode)
syst_float_set_rounding_mode(int8_t mode)
{
switch (mode)
{
@ -93,7 +93,7 @@ syst_float_set_rounding_mode(int8 mode)
float32
syst_int32_to_float32(int32 a)
syst_int32_to_float32(int32_t a)
{
float32 z;
sim_fpu s;
@ -104,7 +104,7 @@ syst_int32_to_float32(int32 a)
}
float64
syst_int32_to_float64( int32 a )
syst_int32_to_float64( int32_t a )
{
float64 z;
sim_fpu s;
@ -113,10 +113,10 @@ syst_int32_to_float64( int32 a )
return z;
}
int32
int32_t
syst_float32_to_int32_round_to_zero( float32 a )
{
int32 z;
int32_t z;
sim_fpu s;
sim_fpu_32to (&s, a);
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;
}
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_64to (&s, a);
flags |= sim_fpu_to32i (&z, &s, sim_fpu_round_zero);