aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-n-bits.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-09-05 00:30:38 +0000
committerAndrew Cagney <cagney@redhat.com>1997-09-05 00:30:38 +0000
commit30efae3acdacbd3239bd7385a5b535abf5ed23e9 (patch)
tree4e7757304f2588b575f205ab3600c3fd05307af2 /sim/common/sim-n-bits.h
parentc142a1f507edd58eaa3aa708baaf7ca49a5cf031 (diff)
downloadgdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.zip
gdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.tar.gz
gdb-30efae3acdacbd3239bd7385a5b535abf5ed23e9.tar.bz2
Define SIGNED64 and UNSIGNED64 macros - handle MSC/GCC LL issue.
Diffstat (limited to 'sim/common/sim-n-bits.h')
-rw-r--r--sim/common/sim-n-bits.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/sim/common/sim-n-bits.h b/sim/common/sim-n-bits.h
index 0843af3..5c0aa55 100644
--- a/sim/common/sim-n-bits.h
+++ b/sim/common/sim-n-bits.h
@@ -42,7 +42,8 @@
#define LSMASKn XCONCAT2(LSMASK,N)
#define MSMASKEDn XCONCAT2(MSMASKED,N)
#define MSMASKn XCONCAT2(MSMASK,N)
-#define EXTRACTEDn XCONCAT2(EXTRACTED,N)
+#define LSEXTRACTEDn XCONCAT2(LSEXTRACTED,N)
+#define MSEXTRACTEDn XCONCAT2(MSEXTRACTED,N)
#define INSERTEDn XCONCAT2(INSERTED,N)
#define ROTn XCONCAT2(ROT,N)
#define ROTLn XCONCAT2(ROTL,N)
@@ -80,16 +81,29 @@ MSMASKEDn (unsignedN word,
return (word & MSMASKn (nr_bits));
}
-/* TAGS: EXTRACTED16 EXTRACTED32 EXTRACTED64 */
+/* TAGS: LSEXTRACTED16 LSEXTRACTED32 LSEXTRACTED64 */
INLINE_SIM_BITS\
(unsignedN)
-EXTRACTEDn (unsignedN val,
- unsigned start,
- unsigned stop)
+LSEXTRACTEDn (unsignedN val,
+ unsigned start,
+ unsigned stop)
{
- val <<= _MSB_SHIFT (N, start);
- val >>= (_MSB_SHIFT (N, start) + _LSB_SHIFT (N, stop));
+ val <<= (N - 1 - start); /* drop high bits */
+ val >>= (N - 1 - start) + (stop); /* drop low bits */
+ return val;
+}
+
+/* TAGS: MSEXTRACTED16 MSEXTRACTED32 MSEXTRACTED64 */
+
+INLINE_SIM_BITS\
+(unsignedN)
+MSEXTRACTEDn (unsignedN val,
+ unsigned start,
+ unsigned stop)
+{
+ val <<= (start); /* drop high bits */
+ val >>= (start) + (N - 1 - stop); /* drop low bits */
return val;
}
@@ -169,7 +183,8 @@ SEXTn (signedN val,
#undef ROTRn
#undef ROTn
#undef INSERTEDn
-#undef EXTRACTEDn
+#undef LSEXTRACTEDn
+#undef MSEXTRACTEDn
#undef LSMASKEDn
#undef LSMASKn
#undef MSMASKEDn