aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2014-05-12 19:05:19 -0400
committerDJ Delorie <dj@redhat.com>2014-05-12 19:05:19 -0400
commita7da346e5c9dd33f4fdc9b053d1991131a911926 (patch)
tree81950bdfdf49a2a11081c842c12f842ee7f8ecf3
parent17b609c3fc8f78852655096a1be04fdd2ba3809c (diff)
downloadgdb-a7da346e5c9dd33f4fdc9b053d1991131a911926.zip
gdb-a7da346e5c9dd33f4fdc9b053d1991131a911926.tar.gz
gdb-a7da346e5c9dd33f4fdc9b053d1991131a911926.tar.bz2
Support 32->64 sign extension in msp430's sign_ext
* msp43-sim.c (sign_ext): Change to "long long" to support sign-extending 32-bit values.
-rw-r--r--sim/msp430/ChangeLog5
-rw-r--r--sim/msp430/msp430-sim.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index 4b76a03..77ea380 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -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
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index 693fdee..2dcbae3 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -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;