-
Notifications
You must be signed in to change notification settings - Fork 57
node: Fix mask-or operator precedence by replacing +
with |
#210
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
Conversation
fe8f79c
to
4b08084
Compare
CI says:
Should we bump MSRV, lock |
I think we do want to test against the newest available and compiler supported version though. We have a separate minimal test... |
Specifically, you want to check MSRV against the latest crate dependencies? That means we'll always be at the merit of our (transitive) dependencies bumping MSRV, and our CI subsequently failing on random PRs. I'd prefer to combine the MSRV test with the |
Note that that's what I did in #212, and we should probably continue this discussion there. Alternatively, we perhaps can and should exclude our examples / |
2ed1d78
to
45fb8dc
Compare
@Drakulix I've also included all CI fixes in this one PR (the oldest) so that it can hopefully all go in using rebase-merge while the CI is green/happy with the final result :) |
c3afe5f
to
8304cdd
Compare
A request for using masks and shifts on the known `0-1-2` constants defining the minor type of a DRM node resulted in the expression to maintain the original `+` from first subtracting the current node type followed by adding the requested node type. As the subtract of the current node type was replaced by a mask, the resulting `old_id & ID_MASK + minor_base` expression is interpreted as `old_id & (ID_MASK + minor_base)` because of operator precedence, while it would have been correctly interpreted as `(old_id & ID_MASK) | minor_base` when the correct `|` OR operator is used.
Group all this logic together in functions inside `impl NodeType`.
8304cdd
to
47191de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fixes #209, CC @jbeich
A request for using masks and shifts on the known
0-1-2
constants defining the minor type of a DRM node resulted in the expression to maintain the original+
from first subtracting the current node type followed by adding the requested node type. As the subtract of the current node type was replaced by a mask, the resultingold_id & ID_MASK + minor_base
expression is interpreted asold_id & (ID_MASK + minor_base)
because of operator precedence, while it would have been correctly interpreted as(old_id & ID_MASK) | minor_base
when the correct|
OR operator is used.