Commit e769d50f authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Fix check for bit manipulation range fit

parent 6c352b41
......@@ -74,7 +74,7 @@ uint32_t bitMask(uint32_t firstBit, uint32_t lastBit) {
void setBitsWithValue(uint32_t &target, uint32_t firstBit, uint32_t lastBit,
uint32_t value) {
// check if value is larger than bit range
if (value > (1u << (lastBit + 1u - firstBit))) {
if (value > (1u << (lastBit + firstBit))) {
BOOST_LOG_TRIVIAL(error)
<< "value: " << value << ", 1 << (last-bit - firstbit) "
<< (1 << (lastBit - firstBit)) << ", bitrange: " << lastBit - firstBit
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment