__ROR__
: ROtate Right (circular rotation to the right)__ROR1__
: uint8__ROR2__
: uint16__ROR3__
: uint24__ROR4__
: uint32
__ROL__
: ROtate Left (circular rotation to the left)__ROL1__
: uint8__ROL2__
: uint16__ROL3__
: uint24__ROL4__
: uint32
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)
Ref : https://www.geeksforgeeks.org/rotate-bits-of-an-integer/