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
This commit is contained in:
Ali Saidi 2007-05-09 12:01:31 -04:00
parent 8d56145d7b
commit ee70d8cfc4

View file

@ -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);
}
/**