Microsoft.Protocols.TestSuites.Common.BufferReader.ReadInt16 C# (CSharp) Method

ReadInt16() public method

Reads a 2-byte signed integer from the current position and advances the current position of the buffer by 2 bytes.
public ReadInt16 ( ) : short
return short
        public short ReadInt16()
        {
            if (this.position + 1 >= this.length)
            {
                throw new Exception("bufferReader out of bound.");
            }

            short low = (short)this.buffer[this.position++];
            short high = (short)(this.buffer[this.position++] << 8);
            return (short)(low + high);
        }