Skip to content

Commit 9a347c9

Browse files
committed
Fix test
Reason: When shifting to the left, but the number of bits is not 64, the shift will not shift enough so bits of the next byte might be also in v. With this masking they can be removed
1 parent 9fc66dc commit 9a347c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/message.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ Message::ParseSignalsStatus Message::parseSignals(const std::vector<uint8_t>& da
6666
break;
6767
}
6868
}
69-
} else
70-
values.push_back(v * signal.factor + signal.offset);
69+
} else {
70+
// use only the relevant bits
71+
values.push_back((v & ((1 << signal.size) - 1)) * signal.factor + signal.offset);
72+
}
7173
}
7274
return ParseSignalsStatus::Success;
7375
}

0 commit comments

Comments
 (0)