-
Notifications
You must be signed in to change notification settings - Fork 42
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
Constant space from base conversions #293
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
==========================================
- Coverage 82.85% 82.59% -0.27%
==========================================
Files 53 53
Lines 5681 5704 +23
==========================================
+ Hits 4707 4711 +4
- Misses 974 993 +19
☔ View full report in Codecov by Sentry. |
approach is good, i think we still disagree on the behavior wrt infinite iterators |
This is mostly orthogonal to how long iterators are handled and should make things strictly better. Ready for review. I mostly wrote it because abusing the stack to reverse a list seemed like a bad idea. |
src/algorithms/mul.rs
Outdated
/// Computes `lhs *= a` and returns the carry. | ||
pub fn mul_nx1(lhs: &mut [u64], a: u64) -> u64 { | ||
let mut carry = 0; | ||
for lhs in lhs.iter_mut() { |
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.
if lhs
is empty this will return 0. is this intended, or should it return a
? my belief is that a 0-byte uint always represents the number 0, so carry on a mul is always 0.
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.
my belief is that a 0-byte uint always represents the number 0
This is correct. See for example U0::ZERO
. (This is also the reason why no Uint::ONE
can exits)
Motivation
Solution
PR Checklist