aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-20 09:33:04 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-21 13:38:12 -0400
commitf55b33d51b056c665568c6204bd3ced7f1ec15c8 (patch)
treec03b7fd84f41828633ed1ab14b9c8570463938c9 /sim
parent618b526e31d3df71e9526a0753271624a568564e (diff)
downloadgdb-f55b33d51b056c665568c6204bd3ced7f1ec15c8.zip
gdb-f55b33d51b056c665568c6204bd3ced7f1ec15c8.tar.gz
gdb-f55b33d51b056c665568c6204bd3ced7f1ec15c8.tar.bz2
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.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/sim-types.h103
2 files changed, 27 insertions, 82 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index dcaa240..30a121c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2015-06-21 Mike Frysinger <vapier@gentoo.org>
+ * 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 <vapier@gentoo.org>
+
* sim-alu.h (_SIM_ALU_H_): Rename to ...
(SIM_ALU_H): ... this.
* sim-assert.h (_SIM_ASSERT_H_): Rename to ...
diff --git a/sim/common/sim-types.h b/sim/common/sim-types.h
index 8244e7d..862f4e0 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 <stdint.h>
/* 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 */