-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Sign extend signed integers #238
Sign extend signed integers #238
Conversation
Could you add tests to the |
Since there's no change to attributes I think it's alright as is (current test cases were updated) |
Is there a way to reduce the duplication of code between signed/non-signed? I'm open to having this as a separate issue. |
Friendly ping @korrat are you still interested in pursuing this PR? |
4d118dc
to
547d83c
Compare
Sorry, @sharksforarms, totally forgot about this one. I'm still interested in pursuing this PR.
I've tried to merge the |
Previously, the two macros to implement DekuRead for integer primitives contained nearly identical code, with the exception of sign-extending in the signed integer implementation. With this commit, signed integers reuse the code of their unsigned counterparts and add sign-extending on top.
Here's a proposal to reduce the duplication. Let me know if this is what you had in mind. Alternatively, it should be possible to use a single implementation for the integer types and instead proxy the float implementations through unsigned integers, similarly to how it's done for the signed integers in this commit. |
I can reproduce the compile error on master, so I think it is unrelated to the changes in this PR. I think the error is related to rust-lang/rust#79609. Defining |
Hey @korrat sorry for my delay. The PR looks good at first glance, I'll take some time this week to look at it. A separate PR would be appreciated! |
Thanks! Released in 0.13.0 |
This PR changes the implementation of
DekuRead
for signed integer primitive types, so that reads with a bit size less than the size of the underlying type are sign extended.Fixes #236.