You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason for this is that, on x64 architectures, the CPU instruction for shifting only considers the first six bits of the second shift operand. Effectively, the CPU performs the following operation:
(1ull << 0) - 1
That means your rearranged formula would produce an incorrect result in the special case of a bit size of 64.
Interestingly, replacing the volatile keyword by constexpr will make g++ produce a program that behaves as expected.
However, to ensure the CPU behaves as intended in all cases, you need to write the code as demonstrated in SignalImpl.cpp.
Hi. Thanks for the wonderful library. I was going through
SignalImpl.cpp
and couldn't understand the signed integer parsing logic.dbcppp/src/SignalImpl.cpp
Line 421 in 944f96f
Could this expression be simplified to:
or there is some bit magic or edge cases in the DBC spec that I'm unaware of. I can raise a PR with simplified code or with documentation.
The text was updated successfully, but these errors were encountered: