Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MODBUS_GET_* macros in case of negative values #441

Merged
merged 1 commit into from
Aug 2, 2019
Merged

Fixed MODBUS_GET_* macros in case of negative values #441

merged 1 commit into from
Aug 2, 2019

Conversation

i-ky
Copy link
Contributor

@i-ky i-ky commented Jul 10, 2018

In case resulting value should be negative it is incorrect to use '+' operator to construct it from pieces, because highest bytes will result in negative number after bitwise shift while others will stay positive. Replacing addition with '|' should solve the issue.

In case resulting value should be negative it is incorrect to use '+' operator to construct it from pieces, because highest bytes will result in negative number after bitwise shift while others will stay positive. Replacing addition with '|' should solve the issue.
@stephane
Copy link
Owner

stephane commented Aug 2, 2019

Great fix, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants