public static ushort ReadUInt16BE(byte[] bytes, int offset)
        {
            if (SysBitConverter.IsLittleEndian)
            {
                var v = ((ushort)bytes[offset] << 8) |
                        ((ushort)bytes[offset + 1]);
                return((ushort)v);
            }

            return(SysBitConverter.ToUInt16(bytes, offset));
        }
Exemple #2
0
 /// <summary>
 /// Reads the value of the specified type from the buffer.
 /// </summary>
 /// <param name="value">The OUT variable to store the DOUBLE value in.</param>
 /// <exception cref="System.ArgumentException"/>
 /// <exception cref="System.ArgumentNullException"/>
 /// <exception cref="System.ArgumentOutOfRangeException"/>
 public void Read(out double value)
 {
     value    = BitConverter.ToUInt16(memory, iterator);
     iterator = (iterator + (int)BufferTypeSize.Double + fastAlign) & fastAlignNot;
 }