From: Mike Frysinger Date: Sat, 20 Jun 2015 03:48:04 +0000 (+0545) Subject: sim: common: use standard intXX_t types for signedXX X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f55b33d51b056c665568c6204bd3ced7f1ec15c8;p=binutils-gdb.git sim: common: use standard intXX_t types for signedXX Let's assume that the system supports the POSIX int8/16/32/64_t types as this collapses the logic significantly. --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index dcaa2409d2e..30a121cd963 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +2015-06-21 Mike Frysinger + + * sim-types.h: Move SIM_TYPES_H define to top of file. Include + stdint.h. Replace all signed/unsigned typedefs with int#_t and + uint#_t. + 2015-06-21 Mike Frysinger * sim-alu.h (_SIM_ALU_H_): Rename to ... diff --git a/sim/common/sim-types.h b/sim/common/sim-types.h index 8244e7da9d7..862f4e0b1c6 100644 --- a/sim/common/sim-types.h +++ b/sim/common/sim-types.h @@ -21,7 +21,9 @@ #ifndef SIM_TYPES_H -/* #define SIM_TYPES_H */ +#define SIM_TYPES_H + +#include /* INTEGER QUANTITIES: @@ -42,96 +44,33 @@ */ -#if !defined (SIM_TYPES_H) && defined (__GNUC__) -#define SIM_TYPES_H - -/* bit based */ - -#define UNSIGNED32(X) ((unsigned32) X##UL) -#define UNSIGNED64(X) ((unsigned64) X##ULL) - -#define SIGNED32(X) ((signed32) X##L) -#define SIGNED64(X) ((signed64) X##LL) - -typedef signed int signed8 __attribute__ ((__mode__ (__QI__))); -typedef signed int signed16 __attribute__ ((__mode__ (__HI__))); -typedef signed int signed32 __attribute__ ((__mode__ (__SI__))); -typedef signed int signed64 __attribute__ ((__mode__ (__DI__))); - -typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__))); -typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__))); -typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__))); -typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__))); - -typedef struct { unsigned64 a[2]; } unsigned128; -typedef struct { signed64 a[2]; } signed128; - -#endif - - -#if !defined (SIM_TYPES_H) && defined (_MSC_VER) -#define SIM_TYPES_H - -/* bit based */ - -#define UNSIGNED32(X) (X##ui32) -#define UNSIGNED64(X) (X##ui64) - -#define SIGNED32(X) (X##i32) -#define SIGNED64(X) (X##i64) - -typedef signed char signed8; -typedef signed short signed16; -typedef signed int signed32; -typedef signed __int64 signed64; - -typedef unsigned int unsigned8; -typedef unsigned int unsigned16; -typedef unsigned int unsigned32; -typedef unsigned __int64 unsigned64; - -typedef struct { unsigned64 a[2]; } unsigned128; -typedef struct { signed64 a[2]; } signed128; - -#endif /* _MSC_VER */ - - -#if !defined (SIM_TYPES_H) -#define SIM_TYPES_H - /* bit based */ -#define UNSIGNED32(X) (X##UL) -#define UNSIGNED64(X) (X##ULL) - -#define SIGNED32(X) (X##L) -#define SIGNED64(X) (X##LL) - -typedef signed char signed8; -typedef signed short signed16; -#if defined (__ALPHA__) -typedef signed int signed32; -typedef signed long signed64; +#ifdef _MSC_VER +# define UNSIGNED32(X) (X##ui32) +# define UNSIGNED64(X) (X##ui64) +# define SIGNED32(X) (X##i32) +# define SIGNED64(X) (X##i64) #else -typedef signed long signed32; -typedef signed long long signed64; +# define UNSIGNED32(X) ((unsigned32) X##UL) +# define UNSIGNED64(X) ((unsigned64) X##ULL) +# define SIGNED32(X) ((signed32) X##L) +# define SIGNED64(X) ((signed64) X##LL) #endif -typedef unsigned char unsigned8; -typedef unsigned short unsigned16; -#if defined (__ALPHA__) -typedef unsigned int unsigned32; -typedef unsigned long unsigned64; -#else -typedef unsigned long unsigned32; -typedef unsigned long long unsigned64; -#endif +typedef int8_t signed8; +typedef int16_t signed16; +typedef int32_t signed32; +typedef int64_t signed64; + +typedef uint8_t unsigned8; +typedef uint16_t unsigned16; +typedef uint32_t unsigned32; +typedef uint64_t unsigned64; typedef struct { unsigned64 a[2]; } unsigned128; typedef struct { signed64 a[2]; } signed128; -#endif - /* byte based */