Esempio n. 1
0
        private void __PutArrayFastLE <T>(T[] x, int elemSize) where T : struct
        {
            ushort len        = x == null ? (ushort)0 : (ushort)x.Length;
            int    bytesCount = elemSize * len;

            ResizeIfNeed(_position + 2 + bytesCount);
            FastBitConverter.GetBytes(_data, _position, len);
            _position += 2;
            if (len == 0)
            {
                return;
            }

            // if we are LE, just do a block copy
            Buffer.BlockCopy(x, 0, _data, _position, bytesCount);
            _position += bytesCount;
        }
Esempio n. 2
0
 public void Write(uint value)
 {
     ResizeIfNeed(_position + 4);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 4;
 }
Esempio n. 3
0
 public void Write(char value)
 {
     ResizeIfNeed(_position + 2);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 2;
 }
Esempio n. 4
0
 public void Write(ulong value)
 {
     ResizeIfNeed(_position + 8);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 8;
 }