aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/bits.c
diff options
context:
space:
mode:
authorMatthew Green <mrg@redhat.com>2002-01-04 00:00:54 +0000
committerMatthew Green <mrg@redhat.com>2002-01-04 00:00:54 +0000
commit5c8844646d88eaf4ec6b9c682fc1a32757fd0c07 (patch)
treefd12b44aa3102091dcc32740922b69ceab85a16c /sim/ppc/bits.c
parentc7b3d5aa454d080ad760b8915e5f1eee0d452861 (diff)
downloadgdb-5c8844646d88eaf4ec6b9c682fc1a32757fd0c07.zip
gdb-5c8844646d88eaf4ec6b9c682fc1a32757fd0c07.tar.gz
gdb-5c8844646d88eaf4ec6b9c682fc1a32757fd0c07.tar.bz2
* bits.c (LSMASKED64): New inline function.
(LSEXTRACTED64): Likewise. * bits.h (_LSB_POS, _LSMASKn, LSMASK64): New macros from sim/common/sim-bits.h (LSMASKED64, LSEXTRACTED64): New functions definitions. * Makefile.in (sim-bits.o): Remove target. * main.c (zalloc): Fix typo in error message.
Diffstat (limited to 'sim/ppc/bits.c')
-rw-r--r--sim/ppc/bits.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sim/ppc/bits.c b/sim/ppc/bits.c
index 00bba51..4a3d9c6 100644
--- a/sim/ppc/bits.c
+++ b/sim/ppc/bits.c
@@ -24,8 +24,28 @@
#include "basics.h"
+INLINE_BITS\
+(unsigned64)
+LSMASKED64 (unsigned64 word,
+ int start,
+ int stop)
+{
+ word &= LSMASK64 (start, stop);
+ return word;
+}
INLINE_BITS\
+(unsigned64)
+LSEXTRACTED64 (unsigned64 val,
+ int start,
+ int stop)
+{
+ val <<= (64 - 1 - start); /* drop high bits */
+ val >>= (64 - 1 - start) + (stop); /* drop low bits */
+ return val;
+}
+
+INLINE_BITS\
(unsigned32)
MASKED32(unsigned32 word,
unsigned start,