Support 32->64 sign extension in msp430's sign_ext
authorDJ Delorie <dj@redhat.com>
Mon, 12 May 2014 23:05:19 +0000 (19:05 -0400)
committerDJ Delorie <dj@redhat.com>
Mon, 12 May 2014 23:05:19 +0000 (19:05 -0400)
* msp43-sim.c (sign_ext): Change to "long long" to support
sign-extending 32-bit values.

sim/msp430/ChangeLog
sim/msp430/msp430-sim.c

index 4b76a03a154031dd009e376af789608733a3c70b..77ea38008a20e7ee0dde76f4c0c6cfaa562c1f13 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-12  DJ Delorie  <dj@redhat.com>
+
+       * msp43-sim.c (sign_ext): Change to "long long" to support
+       sign-extending 32-bit values.
+
 2014-05-08  Nick Clifton  <nickc@redhat.com>
 
        * msp430-sim.c (sim_open): Do not allocate memory over the
index 693fdee627ac3711fd2a328ab36544d17595f5e6..2dcbae33789b71185f76e6161a1ad34cdf7c37f7 100644 (file)
@@ -337,11 +337,11 @@ zero_ext (unsigned int v, unsigned int bits)
   return v;
 }
 
-static signed int
-sign_ext (signed int v, unsigned int bits)
+static signed long long
+sign_ext (signed long long v, unsigned int bits)
 {
-  int sb = 1 << (bits-1);      /* Sign bit.  */
-  int mb = (1 << (bits-1)) - 1; /* Mantissa bits.  */
+  signed long long sb = 1LL << (bits-1);       /* Sign bit.  */
+  signed long long mb = (1LL << (bits-1)) - 1LL; /* Mantissa bits.  */
 
   if (v & sb)
     v = v | ~mb;
This page took 0.032679 seconds and 4 git commands to generate.