def bitswap_int(n, width):
 n &= ((1 << width) - 1)
 s = bits_str(n, endian='little').ljust(width, '0')[:width]
 return int(s, 2)

def bitswap_int ( n , width ) : n &= ( ( 1 << width ) - 1 ) s = bits_str ( n , endian = 'little' ) . ljust ( width , '0' ) [ : width ] return int ( s , 2 )
bitswap_int(n) -> int reverses the bits of a numbers and returns the result as a new number .