EnumUtils: Add Common::ToUnderlying

Mirrors the C++23 <utility> function, std::to_underlying
This commit is contained in:
get committed 2023-06-17 07:15:33 -05:00
1 parent 5029924ba1
commit 07ad75f34f
22 files changed
+118 -78

No files matched your search

+4 -3
View File
@@ -14,6 +14,7 @@
#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"
@@ -652,8 +653,8 @@ std::shared_ptr<Device> EmulationKernel::GetDeviceByName(std::string_view device
std::optional<IPCReply> EmulationKernel::OpenDevice(OpenRequest& request)
{
const s32 new_fd = GetFreeDeviceID();
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path, static_cast<u32>(request.flags),
new_fd);
INFO_LOG_FMT(IOS, "Opening {} (mode {}, fd {})", request.path,
Common::ToUnderlying(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");
@@ -731,7 +732,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}", static_cast<u32>(request.command));
ASSERT_MSG(IOS, false, "Unexpected command: {:#x}", Common::ToUnderlying(request.command));
ret = IPCReply{IPC_EINVAL, 978_tbticks};
break;
}