Skip to content

Instantly share code, notes, and snippets.

@MayerDaniel
Created September 22, 2021 00:38
Show Gist options
  • Save MayerDaniel/4b0ba8eaaf502cff39d55eb78647749b to your computer and use it in GitHub Desktop.
Save MayerDaniel/4b0ba8eaaf502cff39d55eb78647749b to your computer and use it in GitHub Desktop.
rol/ror
def __ROL__(num, count, bits=8):
return ((num << count) | (num >> (bits - count))) & ((0b1<<bits) - 1)
def __ROR__(num, count, bits=8):
return ((num >> count) | (num << (bits - count))) & ((0b1<<bits) - 1)
#from https://onsoim.tistory.com/entry/RORROL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment