diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2007-05-09 12:01:31 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2007-05-09 12:01:31 -0400 |
commit | ee70d8cfc430e38b84945e8b9ea870585b98f87c (patch) | |
tree | 0723e90ec3db2aeb3c0994abdceeaaa3fd5d3add /src/base/bitfield.hh | |
parent | 8d56145d7b6f759456993b63692165d4b510adda (diff) | |
download | gem5-ee70d8cfc430e38b84945e8b9ea870585b98f87c.tar.xz |
bit_val was being used directly in the statement in return. If type B had fewer bits than last, bit_val << last would get the wrong answer.
src/base/bitfield.hh:
bit_val was being used directly in the statement in
return. If type B had fewer bits than last, bit_val << last would get
the wrong answer.
--HG--
extra : convert_revision : cbc43ccd139f82ebbd65f30af5d05b87c4edac64
Diffstat (limited to 'src/base/bitfield.hh')
-rw-r--r-- | src/base/bitfield.hh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh index 69cce2245..518bad6b8 100644 --- a/src/base/bitfield.hh +++ b/src/base/bitfield.hh @@ -96,8 +96,9 @@ inline T insertBits(T val, int first, int last, B bit_val) { + T t_bit_val = bit_val; T bmask = mask(first - last + 1) << last; - return ((bit_val << last) & bmask) | (val & ~bmask); + return ((t_bit_val << last) & bmask) | (val & ~bmask); } /** |