Merged
Conversation
DaniPopes
commented
Jul 27, 2023
| let mut cpy = *self; | ||
| cpy.limbs.iter_mut().for_each(|limb| limb.reverse_bits()); | ||
| slice::from_raw_parts(cpy.limbs.as_ptr().cast(), Self::BYTES).to_vec() | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
This used to recurse infinitely (to_le_bytes_vec calls as_le_bytes().into_owned() which is this exact expression), make it actually do something on BE targets
DaniPopes
commented
Jul 27, 2023
Contributor
Author
There was a problem hiding this comment.
This is just a small refactor / code dedup. No logic changed but it would be nice if we could format numbers in BE without allocating the LE digits and rev iter over them.
9b97797 to
39e2a06
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #277 +/- ##
==========================================
+ Coverage 82.57% 82.73% +0.16%
==========================================
Files 52 52
Lines 5595 5648 +53
==========================================
+ Hits 4620 4673 +53
Misses 975 975
☔ View full report in Codecov by Sentry. |
48fa2a7 to
ae968f5
Compare
prestwich
approved these changes
Jul 29, 2023
Collaborator
prestwich
left a comment
There was a problem hiding this comment.
Good. I'm opening issues for further improvements to from_base_le
This was referenced Jul 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Closes #275
Closes #276
Solution
Feature gate certain functions to
"alloc", which is enabled by default through"std".Unfortunately most of these cannot be alloc-free themselves, because of limitations in the Rust const generics (e.g. generic const exprs).
PR Checklist