I am trying to convert this C function into Python;
typedef unsigned long var; /* Bit rotate rightwards */ var ror(var v,unsigned int bits) { ret
The shortest way I've found in Python: (note this works only with integers as inputs)
def ror(n,rotations,width): return (2**width-1)&(n>>rotations|n<<(width-rotations))