I am trying to perform very large bit rotations on non-negative 16-bit integers in Python, however it is very slow. I tried optimizing the process by shifting it by the modulo of 16, but it leaves a bunch of zeros at the end of it. Is there any way to fix this? Can we truncate the binary to a 16 bit window? Are there any other methods to improve performance? I can not use any external libraries.
An example of the operation is 23748 >> 8857328954.
Here is an example of some code I tried:
x = 35233
y = 738337234 % 16
x >> y