def int_to_vlq(val):
    """
    Converts an integer value into a variable length quantity (list).
    """
    vlq = []
    for i in range(21, 0, -7):
        if val >= (1 << i):
            vlq.append(((val >> i) & 0x7F) | 0x80)
    vlq.append(val & 0x7F)
    return vlq