programming-examples/python/Misc/Python program to reverse the bits of an integer (32 bits unsigned).py
2019-11-15 12:59:38 +01:00

9 lines
226 B
Python

def reverse_Bits(n):
result = 0
for i in range(32):
result <<= 1
result |= n & 1
n >>= 1
return result
print(reverse_Bits(1234))