@classmethod
    def read(cls, fd):
        rval, byte_count = 0, 0
        byte = U8.read(fd)

        while (byte & 0x80) != 0 and byte_count < 3:
            rval <<= 7
            rval |= byte & 0x7f

            byte = U8.read(fd)
            byte_count += 1

        if byte_count < 3:
            rval <<= 7
            rval |= byte & 0x7F
        else:
            rval <<= 8
            rval |= byte & 0xff

        if (rval & 0x10000000) != 0:
            rval -= 0x20000000

        return rval
dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/packages/flashmedia/types.py/AMF3Integer.read/original