예제 #1
0
        public void WriteVarLong(long value)
        {
            uint i   = 0;
            var  val = CustomInt64.fromNumber(value);

            if (val.high == 0)
            {
                WriteInt32(_data, val.low);
            }
            else
            {
                i = 0;
                while (i < 4)
                {
                    _data.WriteByte((byte)((val.low & 127) | 128));
                    val.low = val.low >> 7;
                    i++;
                }
                if ((val.high & (268435455 << 3)) == 0)
                {
                    _data.WriteByte((byte)((val.high << 4) | val.low));
                }
                else
                {
                    _data.WriteByte((byte)((((val.high << 4) | val.low) & 127) | 128));
                    WriteInt32(_data, val.high >> 3);
                }
            }
        }
        public void WriteVarLong(long value)
        {
            uint        i           = 0;
            CustomInt64 customInt64 = CustomInt64.fromNumber(value);

            if (customInt64.high != 0)
            {
                for (i = 0; i < 4; i++)
                {
                    this._data.WriteByte((byte)(customInt64.low & 127 | 128));
                    customInt64.low >>= 7;
                }
                if ((customInt64.high & 2147483640) != 0)
                {
                    this._data.WriteByte((byte)((customInt64.high << 4 | customInt64.low) & 127 | 128));
                    CustomDataWriter.writeint32(this._data, customInt64.high >> 3);
                }
                else
                {
                    this._data.WriteByte((byte)(customInt64.high << 4 | customInt64.low));
                }
            }
            else
            {
                CustomDataWriter.writeint32(this._data, customInt64.low);
            }
        }