summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-02-18 19:57:58 -0500
committerAli Saidi <saidi@eecs.umich.edu>2007-02-18 19:57:58 -0500
commit9062525c239ba94083d6517ebff0aa88ab82be92 (patch)
tree903ab0819ef4ee8689043edc457a722f0c1316d4 /src/base
parent4e7f8c088522dbf512ae02780f53cdccadb2474a (diff)
parentbd367d4825e26ab3f8e01f3b4bdb914bb0ef756a (diff)
downloadgem5-9062525c239ba94083d6517ebff0aa88ab82be92.tar.xz
Merge zizzer:/bk/newmem
into zeep.pool:/z/saidi/work/m5.newmem --HG-- extra : convert_revision : 10d4dc08411c7a433a7194e94f69ca1d639a1ce7
Diffstat (limited to 'src/base')
-rw-r--r--src/base/bitfield.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh
index 1fc0bad5d..0f1233677 100644
--- a/src/base/bitfield.hh
+++ b/src/base/bitfield.hh
@@ -44,6 +44,7 @@ mask(int nbits)
}
+
/**
* Extract the bitfield from position 'first' to 'last' (inclusive)
* from 'val' and right justify it. MSB is numbered 63, LSB is 0.
@@ -69,6 +70,12 @@ mbits(T val, int first, int last)
return val & (mask(first+1) & ~mask(last));
}
+inline uint64_t
+mask(int first, int last)
+{
+ return mbits((uint64_t)-1LL, first, last);
+}
+
/**
* Sign-extend an N-bit value to 64 bits.
*/