Skip to content

Commit

Permalink
Even more div_ceil fixes (#691)
Browse files Browse the repository at this point in the history
Fixes the remaining cases which were missed in #688 and #689
  • Loading branch information
tarcieri authored Oct 8, 2024
1 parent c296419 commit be1202e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/uint/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct BoxedUint {

impl BoxedUint {
fn limbs_for_precision(at_least_bits_precision: u32) -> usize {
((at_least_bits_precision + Limb::BITS - 1) / Limb::BITS) as usize
at_least_bits_precision.div_ceil(Limb::BITS) as usize
}

/// Get the value `0` represented as succinctly as possible.
Expand Down
2 changes: 1 addition & 1 deletion src/uint/boxed/div.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl BoxedUint {

let dbits = rhs.bits();
assert!(dbits > 0, "zero divisor");
let dwords = (dbits + Limb::BITS - 1) / Limb::BITS;
let dwords = dbits.div_ceil(Limb::BITS);
let lshift = (Limb::BITS - (dbits % Limb::BITS)) % Limb::BITS;

// Shift entire divisor such that the high bit is set
Expand Down

0 comments on commit be1202e

Please sign in to comment.