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

ReadInt32() public method

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

            int part1 = (int)this.buffer[this.position++];
            int part2 = (int)(this.buffer[this.position++] << 8);
            int part3 = (int)(this.buffer[this.position++] << 16);
            int part4 = (int)(this.buffer[this.position++] << 24);
            return (int)(part1 + part2 + part3 + part4);
        }