-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Calculate distance between u64 without overflow #9592
Calculate distance between u64 without overflow #9592
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9592 +/- ##
========================================
- Coverage 80.6% 80.6% -0.1%
========================================
Files 279 279
Lines 63564 63578 +14
========================================
+ Hits 51245 51253 +8
- Misses 12319 12325 +6 |
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.
lgtm
@@ -412,11 +412,19 @@ pub fn broadcast_shreds( | |||
Ok(()) | |||
} | |||
|
|||
fn distance(a: u64, b: u64) -> u64 { |
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.
Can we call this abs
for absolute value? (same name as std::num crate)
* fix overflow * fixed num_live_peers overflow (cherry picked from commit 77fb423) # Conflicts: # core/src/broadcast_stage.rs
* fix overflow * fixed num_live_peers overflow (cherry picked from commit 77fb423)
Problem
u64 unchecked subtract
Summary of Changes
calculate a numerical distance instead
Fixes #9590