-
Notifications
You must be signed in to change notification settings - Fork 15
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
panic with 32 bit signed int in 64b bitfield #24
Comments
I've been looking at this for a bit. It seems the root cause is in signed casting which extends the signed bit. This demonstrates the idea: https://github.com/wrenger/bitfield-struct-rs/compare/main...jerrinot:bitfield-struct-rs:sign_shifting?expand=1#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R733-R761 I am fairly sure there is a better fix, I have no idea what am I doing :) |
Oh yes, thanks for catching this. This happens when the fields have the same bit size as their signed type. I've redesigned the bounds check accordingly in 8de2078, which will land in 5.5. |
many thanks for a super quick fix and release! I just included the latest version in my project and it works like a charm! |
Thanks for this cool macro!
This code is panicking with
value out of bounds
:When I change it to
then it's working fine.
The text was updated successfully, but these errors were encountered: