c++23: Replace Common::ToUnderlying with std::to_underlying

Requires at least GCC 11, Clang 13, MSVC 19.30 (VS2022 17.0), or AppleClang 13.1.6 (XCode 13.3).
This commit is contained in:
Joshua Vandaële
2026-01-09 23:49:10 +01:00
parent cc0ce62e7f
commit 55f0715ad4
38 changed files with 148 additions and 167 deletions
+2 -2
View File
@@ -38,12 +38,12 @@ if (COMPILER STREQUAL "GNU")
set(COMPILER "GCC") # prefer printing GCC instead of GNU
endif()
# Enforce minimum compiler versions that support the c++20 features we use
# Enforce minimum compiler versions that support the c++23 features we use
set (GCC_min_version 11)
set (Clang_min_version 14)
set (AppleClang_min_version 14.0.3)
set (min_xcode_version "14.0") # corresponding xcode version for AppleClang_min_version
set (MSVC_min_version 14.32)
set (MSVC_min_version 19.30)
set (min_vs_version "2022 17.2.3") # corresponding Visual Studio version for MSVC_min_version
message(STATUS "Using ${COMPILER} ${CMAKE_CXX_COMPILER_VERSION}")
+3 -2
View File
@@ -7,7 +7,8 @@
#include <jni.h>
#include "Common/EnumUtils.h"
#include <utility>
#include "Common/IniFile.h"
#include "jni/AndroidCommon/AndroidCommon.h"
#include "jni/AndroidCommon/IDCache.h"
@@ -70,7 +71,7 @@ Java_org_dolphinemu_dolphinemu_utils_GpuDriverHelper_00024Companion_getSystemDri
properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
properties2.pNext = &driverProperties;
vkGetPhysicalDeviceProperties2(gpu_list.front(), &properties2);
driverId = fmt::format("{}", Common::ToUnderlying(driverProperties.driverID));
driverId = fmt::format("{}", std::to_underlying(driverProperties.driverID));
}
else
{
+3 -3
View File
@@ -11,9 +11,9 @@
#include <initializer_list>
#include <span>
#include <type_traits>
#include <utility>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
namespace Common
{
@@ -237,8 +237,8 @@ public:
m_hex |= static_cast<std::underlying_type_t<T>>(bit);
}
}
auto operator[](T bit) { return FlagBit(&m_hex, Common::ToUnderlying(bit)); }
auto operator[](T bit) const { return FlagBit(&m_hex, Common::ToUnderlying(bit)); }
auto operator[](T bit) { return FlagBit(&m_hex, std::to_underlying(bit)); }
auto operator[](T bit) const { return FlagBit(&m_hex, std::to_underlying(bit)); }
std::underlying_type_t<T> m_hex = 0;
};
-1
View File
@@ -60,7 +60,6 @@ add_library(common
ENet.h
EnumFormatter.h
EnumMap.h
EnumUtils.h
Event.h
FatFsUtil.cpp
FatFsUtil.h
-15
View File
@@ -1,15 +0,0 @@
// SPDX-License-Identifier: CC0-1.0
#pragma once
#include <type_traits>
namespace Common
{
// TODO: Replace with std::to_underlying in C++23
template <typename Enum>
constexpr std::underlying_type_t<Enum> ToUnderlying(Enum e) noexcept
{
return static_cast<std::underlying_type_t<Enum>>(e);
}
} // namespace Common
+3 -2
View File
@@ -5,8 +5,9 @@
#include <SFML/Network/Packet.hpp>
#include <utility>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/Swap.h"
#include "Common/TypeUtils.h"
@@ -17,7 +18,7 @@ sf::Packet& operator>>(sf::Packet& packet, Common::BigEndianValue<u64>& data);
template <Common::Enum Enum>
sf::Packet& operator<<(sf::Packet& packet, Enum e)
{
packet << Common::ToUnderlying(e);
packet << std::to_underlying(e);
return packet;
}
+2 -2
View File
@@ -16,10 +16,10 @@
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/TypeUtils.h"
std::string StringFromFormatV(const char* format, va_list args);
@@ -157,7 +157,7 @@ std::string ValueToString(s64 value);
std::string ValueToString(bool value);
std::string ValueToString(Common::Enum auto value)
{
return ValueToString(Common::ToUnderlying(value));
return ValueToString(std::to_underlying(value));
}
// Generates an hexdump-like representation of a binary data blob.
+2 -3
View File
@@ -7,12 +7,12 @@
#include <algorithm>
#include <limits>
#include <string>
#include <utility>
#include <vector>
#include <fmt/format.h>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
@@ -133,8 +133,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
break;
default:
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}",
Common::ToUnderlying(opc.params[j].type));
ERROR_LOG_FMT(DSPLLE, "Unknown parameter type: {:x}", std::to_underlying(opc.params[j].type));
break;
}
}
+20 -20
View File
@@ -4,9 +4,9 @@
#include "Core/DSP/Jit/x64/DSPJitRegCache.h"
#include <cstddef>
#include <utility>
#include "Common/Assert.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Core/DSP/DSPCore.h"
@@ -367,38 +367,38 @@ void DSPJitRegCache::FlushRegs()
}
ASSERT_MSG(DSPLLE, m_xregs[RSP].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
Common::ToUnderlying(RSP));
std::to_underlying(RSP));
ASSERT_MSG(DSPLLE, m_xregs[RBX].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
Common::ToUnderlying(RBX));
std::to_underlying(RBX));
ASSERT_MSG(DSPLLE, m_xregs[RBP].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(RBP));
std::to_underlying(RBP));
ASSERT_MSG(DSPLLE, m_xregs[RSI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(RSI));
std::to_underlying(RSI));
ASSERT_MSG(DSPLLE, m_xregs[RDI].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(RDI));
std::to_underlying(RDI));
#ifdef STATIC_REG_ACCS
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
Common::ToUnderlying(R8));
std::to_underlying(R8));
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
Common::ToUnderlying(R9));
std::to_underlying(R9));
#else
ASSERT_MSG(DSPLLE, m_xregs[R8].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R8));
std::to_underlying(R8));
ASSERT_MSG(DSPLLE, m_xregs[R9].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R9));
std::to_underlying(R9));
#endif
ASSERT_MSG(DSPLLE, m_xregs[R10].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R10));
std::to_underlying(R10));
ASSERT_MSG(DSPLLE, m_xregs[R11].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R11));
std::to_underlying(R11));
ASSERT_MSG(DSPLLE, m_xregs[R12].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R12));
std::to_underlying(R12));
ASSERT_MSG(DSPLLE, m_xregs[R13].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R13));
std::to_underlying(R13));
ASSERT_MSG(DSPLLE, m_xregs[R14].guest_reg == DSP_REG_NONE, "wrong xreg state for {}",
Common::ToUnderlying(R14));
std::to_underlying(R14));
ASSERT_MSG(DSPLLE, m_xregs[R15].guest_reg == DSP_REG_STATIC, "wrong xreg state for {}",
Common::ToUnderlying(R15));
std::to_underlying(R15));
m_use_ctr = 0;
}
@@ -985,14 +985,14 @@ void DSPJitRegCache::SpillXReg(X64Reg reg)
{
ASSERT_MSG(DSPLLE, !m_regs[m_xregs[reg].guest_reg].used,
"to be spilled host reg {:#x} (guest reg {:#x}) still in use!",
Common::ToUnderlying(reg), m_xregs[reg].guest_reg);
std::to_underlying(reg), m_xregs[reg].guest_reg);
MovToMemory(m_xregs[reg].guest_reg);
}
else
{
ASSERT_MSG(DSPLLE, m_xregs[reg].guest_reg == DSP_REG_NONE,
"to be spilled host reg {:#x} still in use!", Common::ToUnderlying(reg));
"to be spilled host reg {:#x} still in use!", std::to_underlying(reg));
}
}
@@ -1037,7 +1037,7 @@ void DSPJitRegCache::GetXReg(X64Reg reg)
{
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", Common::ToUnderlying(reg));
ERROR_LOG_FMT(DSPLLE, "Trying to get statically used XReg {}", std::to_underlying(reg));
return;
}
@@ -1053,7 +1053,7 @@ void DSPJitRegCache::PutXReg(X64Reg reg)
{
if (m_xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", Common::ToUnderlying(reg));
ERROR_LOG_FMT(DSPLLE, "Trying to put statically used XReg {}", std::to_underlying(reg));
return;
}
+5 -5
View File
@@ -8,10 +8,10 @@
#include <cstdio>
#include <functional>
#include <unordered_map>
#include <utility>
#include <vector>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Core/PowerPC/Gekko.h"
namespace Core
@@ -71,15 +71,15 @@ enum class BranchWatchSelectionInspection : u8
constexpr BranchWatchSelectionInspection operator|(BranchWatchSelectionInspection lhs,
BranchWatchSelectionInspection rhs)
{
return static_cast<BranchWatchSelectionInspection>(Common::ToUnderlying(lhs) |
Common::ToUnderlying(rhs));
return static_cast<BranchWatchSelectionInspection>(std::to_underlying(lhs) |
std::to_underlying(rhs));
}
constexpr BranchWatchSelectionInspection operator&(BranchWatchSelectionInspection lhs,
BranchWatchSelectionInspection rhs)
{
return static_cast<BranchWatchSelectionInspection>(Common::ToUnderlying(lhs) &
Common::ToUnderlying(rhs));
return static_cast<BranchWatchSelectionInspection>(std::to_underlying(lhs) &
std::to_underlying(rhs));
}
constexpr BranchWatchSelectionInspection& operator|=(BranchWatchSelectionInspection& self,
+2 -2
View File
@@ -7,6 +7,7 @@
#include <memory>
#include <mutex>
#include <string>
#include <utility>
#include <vector>
#include <fmt/format.h>
@@ -27,7 +28,6 @@
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/Crypto/SHA1.h"
#include "Common/EnumUtils.h"
#include "Common/Random.h"
#include "Common/Timer.h"
#include "Common/Version.h"
@@ -396,7 +396,7 @@ void DolphinAnalytics::MakePerGameBuilder()
builder.AddData("cfg-gfx-multisamples", Config::Get(Config::GFX_MSAA));
builder.AddData("cfg-gfx-ssaa", Config::Get(Config::GFX_SSAA));
builder.AddData("cfg-gfx-anisotropy",
Common::ToUnderlying(Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY)));
std::to_underlying(Config::Get(Config::GFX_ENHANCE_MAX_ANISOTROPY)));
builder.AddData("cfg-gfx-vsync", Config::Get(Config::GFX_VSYNC));
builder.AddData("cfg-gfx-aspect-ratio", static_cast<int>(Config::Get(Config::GFX_ASPECT_RATIO)));
builder.AddData("cfg-gfx-efb-access", Config::Get(Config::GFX_HACK_EFB_ACCESS_ENABLE));
@@ -5,11 +5,11 @@
#include <cmath>
#include <iterator>
#include <utility>
#include "Common/BitUtils.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/Swap.h"
@@ -208,7 +208,7 @@ void Wiimote::HandleExtensionSwap(ExtensionNumber desired_extension_number,
else
{
INFO_LOG_FMT(WIIMOTE, "Switching to Extension {} (Wiimote {} in slot {})",
Common::ToUnderlying(desired_extension_number), m_index, m_bt_device_index);
std::to_underlying(desired_extension_number), m_index, m_bt_device_index);
m_active_extension = desired_extension_number;
}
+6 -7
View File
@@ -12,7 +12,6 @@
#include <fmt/format.h>
#include "Common/ChunkFile.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/NandPaths.h"
@@ -96,7 +95,7 @@ ESCore::ESCore(Kernel& ios) : m_ios(ios)
if (result != FS::ResultCode::Success && result != FS::ResultCode::AlreadyExists)
{
ERROR_LOG_FMT(IOS_ES, "Failed to create {}: error {}", directory.path,
Common::ToUnderlying(FS::ConvertResult(result)));
std::to_underlying(FS::ConvertResult(result)));
}
// Now update the UID/GID and other attributes.
@@ -1116,7 +1115,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(ca) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -1132,7 +1131,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_ImportCertificate(issuer) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -1142,7 +1141,7 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: IOSC_VerifyPublicKeySign failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -1152,13 +1151,13 @@ ReturnCode ESCore::VerifyContainer(VerifyContainerType type, VerifyMode mode,
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the issuer cert failed with return code {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
}
ret = WriteNewCertToStore(ca_cert);
if (ret != IPC_SUCCESS)
ERROR_LOG_FMT(IOS_ES, "VerifyContainer: Writing the CA cert failed with return code {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
}
if (ret == IPC_SUCCESS && issuer_handle_out)
+5 -5
View File
@@ -3,11 +3,11 @@
#include "Core/IOS/ES/ES.h"
#include <utility>
#include <vector>
#include "Common/Crypto/SHA1.h"
#include "Common/Crypto/ec.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/ScopeGuard.h"
#include "Common/StringUtil.h"
@@ -165,7 +165,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifySign: VerifyContainer(ng) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -173,7 +173,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(ap) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -187,7 +187,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_ImportPublicKey(ap) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -196,7 +196,7 @@ ReturnCode ESCore::VerifySign(const std::vector<u8>& hash, const std::vector<u8>
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "VerifySign: IOSC_VerifyPublicKeySign(data) failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
+3 -5
View File
@@ -12,7 +12,6 @@
#include "Common/Align.h"
#include "Common/Crypto/SHA1.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/NandPaths.h"
#include "Core/CommonTitles.h"
@@ -73,7 +72,7 @@ ReturnCode ESCore::ImportTicket(const std::vector<u8>& ticket_bytes,
if (ret < 0)
{
ERROR_LOG_FMT(IOS_ES, "ImportTicket: Failed to unpersonalise ticket for {:016x} ({})",
ticket.GetTitleId(), Common::ToUnderlying(ret));
ticket.GetTitleId(), std::to_underlying(ret));
return ret;
}
}
@@ -163,7 +162,7 @@ ReturnCode ESCore::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes,
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "ImportTmd: VerifyContainer failed with error {}",
Common::ToUnderlying(ret));
std::to_underlying(ret));
return ret;
}
@@ -177,8 +176,7 @@ ReturnCode ESCore::ImportTmd(Context& context, const std::vector<u8>& tmd_bytes,
&context.title_import_export.key_handle);
if (ret != IPC_SUCCESS)
{
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}",
Common::ToUnderlying(ret));
ERROR_LOG_FMT(IOS_ES, "ImportTmd: InitBackupKey failed with error {}", std::to_underlying(ret));
return ret;
}
+2 -2
View File
@@ -6,11 +6,11 @@
#include <algorithm>
#include <cstring>
#include <string_view>
#include <utility>
#include <fmt/format.h>
#include "Common/ChunkFile.h"
#include "Common/EnumUtils.h"
#include "Common/StringUtil.h"
#include "Common/Swap.h"
#include "Core/HW/Memmap.h"
@@ -120,7 +120,7 @@ static void LogResult(ResultCode code, fmt::format_string<Args...> format, Args&
code == ResultCode::Success ? Common::Log::LogLevel::LINFO : Common::Log::LogLevel::LERROR;
GENERIC_LOG_FMT(Common::Log::LogType::IOS_FS, type, "Command: {}: Result {}", command,
Common::ToUnderlying(ConvertResult(code)));
std::to_underlying(ConvertResult(code)));
}
template <typename T, typename... Args>
+3 -4
View File
@@ -14,7 +14,6 @@
#include "Common/Assert.h"
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Common/Timer.h"
@@ -662,8 +661,8 @@ std::shared_ptr<Device> EmulationKernel::GetDeviceByFileDescriptor(const u32 fd)
std::optional<IPCReply> EmulationKernel::OpenDevice(OpenRequest& request)
{
const s32 new_fd = GetFreeDeviceID();
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path,
Common::ToUnderlying(request.flags), new_fd);
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path, std::to_underlying(request.flags),
new_fd);
if (new_fd < 0 || new_fd >= IPC_MAX_FDS)
{
ERROR_LOG_FMT(IOS, "Couldn't get a free fd, too many open files");
@@ -749,7 +748,7 @@ std::optional<IPCReply> EmulationKernel::HandleIPCCommand(const Request& request
ret = device->IOCtlV(IOCtlVRequest{GetSystem(), request.address});
break;
default:
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", Common::ToUnderlying(request.command));
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", std::to_underlying(request.command));
ret = IPCReply{IPC_EINVAL, 978_tbticks};
break;
}
@@ -6,6 +6,7 @@
#include <algorithm>
#include <cmath>
#include <limits>
#include <utility>
#include <vector>
#include <fmt/format.h>
@@ -17,7 +18,6 @@
// clang-format on
#include "Common/Align.h"
#include "Common/EnumUtils.h"
#include "Common/FatFsUtil.h"
#include "Common/Logging/Log.h"
#include "Common/ScopeGuard.h"
@@ -212,7 +212,7 @@ static ErrorCode WriteFile(const std::string& filename, std::span<const u8> tmp_
if (write_error_code != FR_OK)
{
ERROR_LOG_FMT(IOS_WC24, "Failed to write file {} to VFF: {}", filename,
Common::ToUnderlying(write_error_code));
std::to_underlying(write_error_code));
return WC24_ERR_FILE_WRITE;
}
+1 -2
View File
@@ -52,7 +52,6 @@ typedef struct pollfd pollfd_t;
#include <utility>
#include "Common/CommonTypes.h"
#include "Common/EnumUtils.h"
#include "Common/Logging/Log.h"
#include "Core/HW/Memmap.h"
#include "Core/IOS/IOS.h"
@@ -291,7 +290,7 @@ public:
if (socket_entry == WiiSockets.end())
{
ERROR_LOG_FMT(IOS_NET, "DoSock: Error, fd not found ({:08x}, {:08X}, {:08X})", sock,
request.address, Common::ToUnderlying(type));
request.address, std::to_underlying(type));
EnqueueIPCReply(request, -SO_EBADF);
}
else
@@ -4,6 +4,7 @@
#include "Core/IOS/USB/Emulated/LogitechMic.h"
#include <algorithm>
#include <utility>
#include "Core/Config/MainSettings.h"
#include "Core/HW/Memmap.h"
@@ -208,12 +209,12 @@ static constexpr u32 USBGETAID(u8 cs, u8 request, u16 index)
static constexpr u32 USBGETAID(FeatureUnitControlSelector cs, RequestCode request, u16 index)
{
return USBGETAID(Common::ToUnderlying(cs), Common::ToUnderlying(request), index);
return USBGETAID(std::to_underlying(cs), std::to_underlying(request), index);
}
static constexpr u32 USBGETAID(EndpointControlSelector cs, RequestCode request, u16 index)
{
return USBGETAID(Common::ToUnderlying(cs), Common::ToUnderlying(request), index);
return USBGETAID(std::to_underlying(cs), std::to_underlying(request), index);
}
int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
@@ -228,7 +229,7 @@ int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
DEBUG_LOG_FMT(IOS_USB,
"GetAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
"bIndex={:02x} aid={:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
switch (aid)
{
@@ -281,7 +282,7 @@ int LogitechMic::GetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
WARN_LOG_FMT(IOS_USB,
"GetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
"bRequest={:02x} bIndex={:02x} aid={:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
break;
}
@@ -301,7 +302,7 @@ int LogitechMic::SetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
DEBUG_LOG_FMT(IOS_USB,
"SetAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
"bIndex={:02x} aid={:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
switch (aid)
{
@@ -344,7 +345,7 @@ int LogitechMic::SetAudioControl(std::unique_ptr<CtrlMessage>& cmd)
WARN_LOG_FMT(IOS_USB,
"SetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
"bRequest={:02x} bIndex={:02x} aid={:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
break;
}
@@ -364,7 +365,7 @@ int LogitechMic::EndpointAudioControl(std::unique_ptr<CtrlMessage>& cmd)
DEBUG_LOG_FMT(IOS_USB,
"EndpointAudioControl: bCs={:02x} bCn={:02x} bRequestType={:02x} bRequest={:02x} "
"bIndex={:02x} aid:{:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
switch (aid)
{
@@ -406,7 +407,7 @@ int LogitechMic::EndpointAudioControl(std::unique_ptr<CtrlMessage>& cmd)
WARN_LOG_FMT(IOS_USB,
"SetAudioControl: Unknown request: bCs={:02x} bCn={:02x} bRequestType={:02x} "
"bRequest={:02x} bIndex={:02x} aid={:08x}",
Common::ToUnderlying(cs), cn, cmd->request_type, Common::ToUnderlying(request),
std::to_underlying(cs), cn, cmd->request_type, std::to_underlying(request),
cmd->index, aid);
break;
}
@@ -544,7 +545,7 @@ static constexpr std::array<u8, 121> FULL_DESCRIPTOR = {
static constexpr u16 LogitechUSBHDR(u8 dir, u8 type, u8 recipient, RequestCode request)
{
return USBHDR(dir, type, recipient, Common::ToUnderlying(request));
return USBHDR(dir, type, recipient, std::to_underlying(request));
}
int LogitechMic::SubmitTransfer(std::unique_ptr<CtrlMessage> cmd)

Some files were not shown because too many files have changed in this diff Show More