Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/uucore/src/lib/features/parser/num_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,7 @@ fn pow_with_context(bd: &BigDecimal, exp: i64, ctx: &Context) -> BigDecimal {
// Count the number of multiplications we're going to perform, one per "1" binary digit
// in exp, and the number of times we can divide exp by 2.
let mut n = exp.unsigned_abs();
// Note: 63 - n.leading_zeros() == n.ilog2, but that's only available in recent Rust versions.
let muls = (n.count_ones() + (63 - n.leading_zeros()) - 1) as u64;
let muls = (n.count_ones() + n.ilog2() - 1) as u64;
// Note: div_ceil would be nice to use here, but only available in recent Rust versions.
// (see note above about minimum Rust version in use)
let margin_extra = (muls + MUL_PER_MARGIN_EXTRA / 2) / MUL_PER_MARGIN_EXTRA;
Expand Down
Loading