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

Faster bit shifting on u32 when shift amount is statically known #57

Open
Sword-Smith opened this issue Sep 22, 2023 · 0 comments
Open

Comments

@Sword-Smith
Copy link
Contributor

We want to speed up this code which is used in NTT

        fn bitreverse(mut n: u32, l: u32) -> u32 {
            let mut r: u32 = 0;
            let mut i: u32 = 0;
            while i < l {
                r = (r << 1) | (n & 1);
                n >>= 1;
                i += 1;
            }

            return r;
        }
@Sword-Smith Sword-Smith changed the title Faster left/right shifting on u32 when shift amount is statically known Faster bit shifting on u32 when shift amount is statically known Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant