Skip to content

Commit

Permalink
Update development guides.
Browse files Browse the repository at this point in the history
This better documents the development requirements and also the algorithm assessment logic.

Related to #180.
  • Loading branch information
Alexhuszagh committed Dec 3, 2024
1 parent 8128624 commit ea30b9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ rustup +nightly component add miri
cargo +nightly install cargo-valgrind
cargo +nightly install cargo-tarpaulin
cargo +nightly install cargo-fuzz
cargo +nightly install cargo-count

# This is only needed if checking the number of lines of unsafe code,
# which uses a deprecated binary that requires an old nightly to
# install.
cargo +nightly install cargo-count --git https://github.com/kbknapp/cargo-count --rev eebe6f8 --locked
```

In addition, the following non-Rust dependencies must be installed:
Expand Down
5 changes: 4 additions & 1 deletion lexical-benchmark/algorithm/division.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ fn fast_div(v: u32) -> (u32, u32) {
#[allow(clippy::manual_div_ceil)]
let left_end = ((1 << (max_precision + additional_precision)) + divisor - 1) / divisor;
let quotient = (v.wrapping_mul(left_end)) >> (max_precision + additional_precision);
let remainder = v - divisor * quotient;
// NOTE: This should never wrap unless the multiplication wraps, which should never
// happen in the cases we use it. Since this is only used for algorithm generation
// and testing, this will never fail in real scenarios.
let remainder = v.wrapping_sub(divisor * quotient);

(quotient, remainder)
}
Expand Down

0 comments on commit ea30b9a

Please sign in to comment.