Example #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;
        }
Example #2
0
 public void Write(uint value)
 {
     ResizeIfNeed(_position + 4);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 4;
 }
Example #3
0
 public void Write(char value)
 {
     ResizeIfNeed(_position + 2);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 2;
 }
Example #4
0
 public void Write(ulong value)
 {
     ResizeIfNeed(_position + 8);
     FastBitConverter.GetBytes(_data, _position, value);
     _position += 8;
 }