Skip to content

Instantly share code, notes, and snippets.

@Spl3en
Created February 21, 2017 21:11
Show Gist options
  • Save Spl3en/5fc93405ded96a70fb607bc037ec351b to your computer and use it in GitHub Desktop.
Save Spl3en/5fc93405ded96a70fb607bc037ec351b to your computer and use it in GitHub Desktop.
rol / ror gcc
inline int rol (int in, int x) {
int res;
__asm__ __volatile__("rol %%eax, %%cl" :"=a"(res) :"a"(in), "c"(x));
return res;
}
inline int ror (int in, int x) {
int res;
__asm__ __volatile__("ror %%eax, %%cl" :"=a"(res) :"a"(in), "c"(x));
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment