-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: alloc feature #277
feat: alloc feature #277
Conversation
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() | ||
}); |
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.
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
src/string.rs
Outdated
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.
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
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.
Good. I'm opening issues for further improvements to from_base_le
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