-
Notifications
You must be signed in to change notification settings - Fork 13
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
add div methods on bigint #117
Conversation
a65f7f1
to
532350c
Compare
Codecov Report
@@ Coverage Diff @@
## master rust-amplify/rust-amplify#117 +/- ##
========================================
+ Coverage 72.4% 73.0% +0.6%
========================================
Files 33 33
Lines 5067 5245 +178
========================================
+ Hits 3667 3829 +162
- Misses 1400 1416 +16
Continue to review full report at Codecov.
|
4cf25f1
to
e5bafdd
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.
Two nits, the rest is looking good.
Sorry for the late review, was ill for last week+.
num/src/bigint.rs
Outdated
@@ -696,7 +859,7 @@ macro_rules! construct_bigint { | |||
type Output = $name; | |||
|
|||
fn div(self, other: T) -> $name { | |||
self.div_rem(other.into()).0 | |||
self.div_rem(other.into()).unwrap().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.
We never do unwrap
in non-test code and should use expect()
. Here, something like
self.div_rem(other.into()).unwrap().0 | |
self.div_rem(other.into()).expect("overflow during big integer division").0 |
will work better
num/src/bigint.rs
Outdated
@@ -716,7 +879,7 @@ macro_rules! construct_bigint { | |||
type Output = $name; | |||
|
|||
fn rem(self, other: T) -> $name { | |||
self.div_rem(other.into()).1 | |||
self.div_rem(other.into()).unwrap().1 |
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.
Ibid
d2abbc8
to
bcb147d
Compare
Thanks for the review,
We have to support |
You are right. Sorry, by bad |
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.
ACK bcb147d
Seems like it needs a rebase now |
rebased |
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.
ACK a4564c8
Closes https://github.com/LNP-BP/rust-amplify/issues/90