def c_int_to_int(b, base_bytes=1):
    """
    Convert compressed integer bytes to integer

    :param b: compressed integer bytes.
    :param base_bytes: len of bytes base from which start compression.
    :return: integer.
    """
    byte_length = 0
    f = 0
    while True:
        v = b[f]
        if v == 255:
            byte_length += 8
            f += 1
            continue
        while v & 128:
            byte_length += 1
            v = v << 1
        break
    n = int.from_bytes(b[:byte_length + base_bytes], byteorder='big')
    if byte_length:
        return n & (1 << (byte_length + base_bytes) * 8 - byte_length) - 1
    return n
