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

Added rol/ror functions to Base (issue #11592) #33938

Closed
wants to merge 2 commits into from

Conversation

jakobnissen
Copy link
Contributor

As discussed in #11592, it would be nice if there were efficient bitwise rotation functions for integers.

This PR adds rol and ror for Int8, Int16, Int32, Int64, Int128 and their unsigned counterparts. On my computer, for all types except the 128-bit ones, the function compiles down to a single rotate instruction. The native code for the 128-bit rotations are quite bad, but I don't know how to optimize that.

@ararslan
Copy link
Member

Looks like @anaveragehuman beat you to it in #33937 by a couple of hours.

@ararslan
Copy link
Member

We appreciate the contribution regardless, @jakobnissen 🙂

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

Successfully merging this pull request may close these issues.

None yet

2 participants