uint icon indicating copy to clipboard operation
uint copied to clipboard

`root`: The division can be turned into bit-shifts when the degree is a power of

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

On 2022-05-31 @recmo wrote in c1a0c34 “Merge pull request #97 from recmo/isqrt”:

The division can be turned into bit-shifts when the degree is a power of two.

        let mut decreasing = false;
        loop {
            // OPT: This could benefit from single-limb multiplication
            // and division.
            //
            // OPT: The division can be turned into bit-shifts when the degree is a power of
            // two.
            let division = result
                .checked_pow(degree - 1)
                .map_or(Self::ZERO, |power| self / power);
            let iter = (division + Self::from(degree - 1) * result) / Self::from(degree);
            match (decreasing, iter.cmp(&result)) {

From src/root.rs:59

github-actions[bot] avatar May 31 '22 20:05 github-actions[bot]