Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base_convert: keep track of non-zero limbs and mul the minimum. #46

Open
github-actions bot opened this issue May 19, 2022 · 0 comments
Open

base_convert: keep track of non-zero limbs and mul the minimum. #46

github-actions bot opened this issue May 19, 2022 · 0 comments
Assignees
Labels
optimize Potential optimization opportunity tracker Issue tracked by bot

Comments

@github-actions
Copy link

github-actions bot commented May 19, 2022

On 2022-05-28 @recmo wrote in b0b5d54 “Mod names”:

keep track of non-zero limbs and mul the minimum.

        for digit in digits {
            if digit >= base {
                return Err(BaseConvertError::InvalidDigit(digit, base));
            }
            // Multiply by base.
            // OPT: keep track of non-zero limbs and mul the minimum.
            let mut carry: u128 = u128::from(digit);
            #[allow(clippy::cast_possible_truncation)]
            for limb in result.limbs.iter_mut() {
                carry += u128::from(*limb) * u128::from(base);
                *limb = carry as u64;

From src/base_convert.rs:93

@github-actions github-actions bot added optimize Potential optimization opportunity tracker Issue tracked by bot labels May 19, 2022
@github-actions github-actions bot changed the title keep track of non-zero limbs and mul the minimum. base_convert:keep track of non-zero limbs and mul the minimum. May 28, 2022
@github-actions github-actions bot changed the title base_convert:keep track of non-zero limbs and mul the minimum. base_convert: keep track of non-zero limbs and mul the minimum. May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimize Potential optimization opportunity tracker Issue tracked by bot
Projects
None yet
Development

No branches or pull requests

1 participant