uint icon indicating copy to clipboard operation
uint copied to clipboard

`algorithms/div/small`: Rewrite in a way that avoids bounds-checks without unsafe.

Open github-actions[bot] opened this issue 2 years ago • 0 comments

On 2022-10-24 @recmo wrote in fb3aa20 “Merge pull request #172 from recmo/div2”:

Rewrite in a way that avoids bounds-checks without unsafe.

/// [`div_nx2_normalized`] but does the shifting of the numerator inline.
///
/// # Panics
///
/// May panics if the above requirements are not met.
// TODO: Rewrite in a way that avoids bounds-checks without unsafe.
#[inline(always)]
pub fn div_nx2(limbs: &mut [u64], divisor: u128) -> u128 {
    debug_assert!(divisor >= 1 << 64);
    debug_assert!(!limbs.is_empty());
    debug_assert!(*limbs.last().unwrap() != 0);

From src/algorithms/div/small.rs:118

github-actions[bot] avatar Oct 24 '22 06:10 github-actions[bot]