Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement
RegId
for Mips and MSP430 #38Implement
RegId
for Mips and MSP430 #38Changes from 6 commits
9c515d4
58f0605
3945ae9
eb4d827
085b779
bd37618
427b906
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
These two checks aren't equivalent.
For example, if
bytes.len() == ptrsize * 72 + 1
, thenchunks_exact
will panic.You can leave this condition in, but do not remove the other one.
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.
Same comment - this check is not sufficient to ensure that
chunks_exact
won't panic.You can leave it in, but you still need the other check as well.
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.
The issue I'm seeing with
if bytes.len() % ptrsize != 0 {
is when U is a u64 there will be 79 registers of size 64 and one register of size 32 (dspctl), thus this check will fail. It looks like chunks_exact actually doesn't panic when there are extra elements, it should still split the bytes up until the end with a possible remainder of 4 bytes.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.
Ahh, yep, you're right.
Well, in any case, I decided to see if the optimizer was smart enough to get rid of any panics, and yep, sure enough it seems to have done the trick:
https://godbolt.org/z/8zsKf9
So yeah, this check can be left as-is.