aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/bits.c
diff options
context:
space:
mode:
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,