MessagePack\BufferUnpacker::unpackInt16 PHP Method

unpackInt16() private method

private unpackInt16 ( )
    private function unpackInt16()
    {
        if (!isset($this->buffer[$this->offset + 1])) {
            throw new InsufficientDataException(2, \strlen($this->buffer) - $this->offset);
        }
        $hi = \ord($this->buffer[$this->offset]);
        $lo = \ord($this->buffer[$this->offset + 1]);
        $this->offset += 2;
        if ($hi > 0x7f) {
            return -(0x10000 - ($hi << 8 | $lo));
        }
        return $hi << 8 | $lo;
    }