Exemplo n.º 1
0
        public unsafe void Write7BitEncoded(ulong data)
        {
            byte *result = stackalloc byte[10];

            byte *position = result;

            ulong secForNextArray = data;

            while (data >= 0x80)
            {
                *position++ = (byte)(data | 0x80);
                data >>= 7;
            }

            *position++ = (byte)data;

            int length = (int)(position - result);

            if (size < length)
            {
                writer.flush(this);
                next.Write7BitEncoded(secForNextArray);
                return;
            }

            fixed(byte *bData = this.data)
            Buffer.MemoryCopy(result, bData + this.position, size, length);

            this.position += length;
            size          -= length;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Writes an ulong 7 bit encoded.
 /// </summary>
 /// <param name="data">The long to write.</param>
 public void Write7BitEncoded(ulong data)
 {
     currentSegment.Write7BitEncoded(data);
 }