private static function decodeIntValue($additional, &$bytes)
    {
        switch($additional)
        {
            case AdditionalType::UINT_8:
                $length = 1;
                break;

            case AdditionalType::UINT_16:
                $length = 2;
                break;

            case AdditionalType::UINT_32:
                $length = 4;
                break;

            case AdditionalType::UINT_64:
                $length = 8;
                break;

            default:
                return $additional;
        }

        self::checkByteArrayLength($bytes, $length);

        // Construct the value
        $value = 0;
        for ($i = $length-1; $i >= 0; $i--)
        {
            $value += array_shift($bytes) << ($i * 8);
        }

        return $value;
    }