def reflect(num, width):
    """Reverts bit order of the given number

    Args:
        num (int): Number that should be reflected
        width (int): Size of the number in bits
    """
    reflected = 0

    for i in range(width):
        if (num >> i) & 1 != 0:
            reflected |= 1 << (width - 1 - i)

    return reflected