def bit_len(i):
    """
    Calculate the bit length of an int
    :param int i: Int
    :return: Length of *i*
    :rtype: int
    """
    length = 0
    while i:
        i >>= 1
        length += 1
    return length