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:
parent
8d56145d7b
commit
ee70d8cfc4
1 changed files with 2 additions and 1 deletions
|
@ -96,8 +96,9 @@ inline
|
||||||
T
|
T
|
||||||
insertBits(T val, int first, int last, B bit_val)
|
insertBits(T val, int first, int last, B bit_val)
|
||||||
{
|
{
|
||||||
|
T t_bit_val = bit_val;
|
||||||
T bmask = mask(first - last + 1) << last;
|
T bmask = mask(first - last + 1) << last;
|
||||||
return ((bit_val << last) & bmask) | (val & ~bmask);
|
return ((t_bit_val << last) & bmask) | (val & ~bmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue