sim: msp430: migrate to standard uintXX_t types
authorMike Frysinger <vapier@gentoo.org>
Mon, 6 Dec 2021 07:14:44 +0000 (02:14 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 6 Jan 2022 06:17:38 +0000 (01:17 -0500)
Move off the sim-specific unsignedXX types and to the standard uintXX_t
types that C11 provides.

sim/msp430/msp430-sim.c
sim/msp430/msp430-sim.h

index bd911a5cf5f3eab99c696630480b3b54fdb2d63b..2ca5e1716d22f88ae39233a7fb225a8fe94a8d14 100644 (file)
@@ -573,7 +573,7 @@ put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val)
                  /* For unsigned 32-bit multiplication of 16-bit operands, an
                     explicit cast is required to prevent any implicit
                     sign-extension.  */
-                 HWMULT (sd, hwmult_result) = (unsigned32) a * (unsigned32) b;
+                 HWMULT (sd, hwmult_result) = (uint32_t) a * (uint32_t) b;
                  HWMULT (sd, hwmult_signed_result) = a * b;
                  HWMULT (sd, hwmult_accumulator) = HWMULT (sd, hwmult_signed_accumulator) = 0;
                  break;
@@ -582,7 +582,7 @@ put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val)
                  a = sign_ext (HWMULT (sd, hwmult_op1), 16);
                  b = sign_ext (HWMULT (sd, hwmult_op2), 16);
                  HWMULT (sd, hwmult_signed_result) = a * b;
-                 HWMULT (sd, hwmult_result) = (unsigned32) a * (unsigned32) b;
+                 HWMULT (sd, hwmult_result) = (uint32_t) a * (uint32_t) b;
                  HWMULT (sd, hwmult_accumulator) = HWMULT (sd, hwmult_signed_accumulator) = 0;
                  break;
 
@@ -590,7 +590,7 @@ put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val)
                  a = HWMULT (sd, hwmult_op1);
                  b = HWMULT (sd, hwmult_op2);
                  HWMULT (sd, hwmult_accumulator)
-                   += (unsigned32) a * (unsigned32) b;
+                   += (uint32_t) a * (uint32_t) b;
                  HWMULT (sd, hwmult_signed_accumulator) += a * b;
                  HWMULT (sd, hwmult_result) = HWMULT (sd, hwmult_accumulator);
                  HWMULT (sd, hwmult_signed_result) = HWMULT (sd, hwmult_signed_accumulator);
@@ -600,7 +600,7 @@ put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val)
                  a = sign_ext (HWMULT (sd, hwmult_op1), 16);
                  b = sign_ext (HWMULT (sd, hwmult_op2), 16);
                  HWMULT (sd, hwmult_accumulator)
-                   += (unsigned32) a * (unsigned32) b;
+                   += (uint32_t) a * (uint32_t) b;
                  HWMULT (sd, hwmult_signed_accumulator) += a * b;
                  HWMULT (sd, hwmult_result) = HWMULT (sd, hwmult_accumulator);
                  HWMULT (sd, hwmult_signed_result) = HWMULT (sd, hwmult_signed_accumulator);
@@ -660,8 +660,8 @@ put_op (SIM_DESC sd, MSP430_Opcode_Decoded *opc, int n, int val)
                {
                case UNSIGN_64:
                  HWMULT (sd, hw32mult_result)
-                   = (unsigned64) HWMULT (sd, hw32mult_op1)
-                   * (unsigned64) HWMULT (sd, hw32mult_op2);
+                   = (uint64_t) HWMULT (sd, hw32mult_op1)
+                   * (uint64_t) HWMULT (sd, hw32mult_op2);
                  break;
                case SIGN_64:
                  HWMULT (sd, hw32mult_result)
index 833caaa9159dc6b5632999a874e9f363ae3c0a5a..d453f3980024e8c28e28e52dd4cbe61688f609f6 100644 (file)
@@ -31,17 +31,17 @@ struct msp430_cpu_state
   int cio_buffer;
 
   hwmult_type  hwmult_type;
-  unsigned16   hwmult_op1;
-  unsigned16   hwmult_op2;
-  unsigned32   hwmult_result;
-  signed32     hwmult_signed_result;
-  unsigned32   hwmult_accumulator;
-  signed32     hwmult_signed_accumulator;
+  uint16_t   hwmult_op1;
+  uint16_t   hwmult_op2;
+  uint32_t   hwmult_result;
+  int32_t     hwmult_signed_result;
+  uint32_t   hwmult_accumulator;
+  int32_t     hwmult_signed_accumulator;
 
   hw32mult_type  hw32mult_type;
-  unsigned32     hw32mult_op1;
-  unsigned32     hw32mult_op2;
-  unsigned64     hw32mult_result;
+  uint32_t     hw32mult_op1;
+  uint32_t     hw32mult_op2;
+  uint64_t     hw32mult_result;
 };
 
 #define HWMULT(SD, FIELD) MSP430_CPU (SD)->state.FIELD