public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [sim/msp430] support 32-bit sign extension
@ 2014-05-12 23:06 DJ Delorie
  0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2014-05-12 23:06 UTC (permalink / raw)
  To: gdb-patches


Needed for the hardware multiply unit.  Committed.

	* msp43-sim.c (sign_ext): Change to "long long" to support
	sign-extending 32-bit values.

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-12 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-12 23:06 [sim/msp430] support 32-bit sign extension DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).