Skip to content

Instantly share code, notes, and snippets.

@GabrielDevCpp
Created August 10, 2023 14:15
Show Gist options
  • Save GabrielDevCpp/018e3c7a22153a81e78746a1c5db7ced to your computer and use it in GitHub Desktop.
Save GabrielDevCpp/018e3c7a22153a81e78746a1c5db7ced to your computer and use it in GitHub Desktop.
Assembly ROR and ROL op in C
unsigned long long ROR(unsigned long long var, unsigned short shift)
{
return (var >> shift | var << (sizeof(var) * CHAR_BIT - shift));
}
unsigned long long ROL(unsigned long long var, unsigned short shift)
{
return (var << shift) | (var >> (sizeof(var) * CHAR_BIT - shift));
}
@GabrielDevCpp
Copy link
Author

These ops rotates the bits to the right or to the left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment