def decode(itr):
    """dencode an integer from a 7-bit+continuation-bit encodeing"""
    r = 0
    x = itr.next()
    r = x & 32767
    while x & 32768:
        x = itr.next()
        r = r << 15 | x & 32767
    return r
