Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge #330
Browse files Browse the repository at this point in the history
330: Fix `fn round_up`. r=justahero a=Urhengulas

It was hardcoding `k` as `4`. This PR changes the fn to actually use `k`.
This resultet in no problem so far, because it was only used with `k=4`.

Co-authored-by: Urhengulas <johann.hemmann@code.berlin>
  • Loading branch information
bors[bot] and Urhengulas committed Jul 20, 2022
2 parents 88f0afc + 70332b0 commit 94d4258
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

- [#330] Fix `fn round_up`
- [#329] Update probe-rs to 0.13.0 (does not yet implement 64-bit support)
- [#328] Simplify, by capturing identifiers in logging macros
- [#326] Make use of i/o locking being static since rust `1.61`.
Expand All @@ -16,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- [#314] Clarify documentation in README
- [#293] Update snapshot tests to new TRACE output

[#330]: https://github.com/knurling-rs/probe-run/pull/330
[#329]: https://github.com/knurling-rs/probe-run/pull/329
[#328]: https://github.com/knurling-rs/probe-run/pull/328
[#326]: https://github.com/knurling-rs/probe-run/pull/326
Expand Down
3 changes: 2 additions & 1 deletion src/canary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,13 @@ impl Canary {
}
}

/// Rounds up to the next multiple of `k` that is greater or equal to `n`.
fn round_up(n: u32, k: u32) -> u32 {
let rem = n % k;
if rem == 0 {
n
} else {
n + 4 - rem
n + k - rem
}
}

Expand Down

0 comments on commit 94d4258

Please sign in to comment.