ams: assume gcc 11

This commit is contained in:
Michael Scire
2021-04-27 23:16:31 -07:00
committed by SciresM
parent 21f3d29df7
commit 0767d9f8da
4 changed files with 20 additions and 25 deletions

View File

@@ -20,14 +20,7 @@ namespace ams::dd {
using ProcessHandle = ::Handle;
/* TODO gcc-11: using MemoryPermission = os::MemoryPermission; using enum os::MemoryPermission; */
enum MemoryPermission {
MemoryPermission_None = 0,
MemoryPermission_ReadOnly = (1u << 0),
MemoryPermission_WriteOnly = (1u << 1),
MemoryPermission_ReadWrite = MemoryPermission_ReadOnly | MemoryPermission_WriteOnly,
};
using MemoryPermission = os::MemoryPermission;
using enum os::MemoryPermission;
}

View File

@@ -54,24 +54,30 @@ namespace ams::tipc {
static constexpr inline bool IsDeferralSupported = !std::same_as<DeferralManagerType, DummyDeferralManager>;
using ResumeKey = typename DeferralManagerType::Key;
static ALWAYS_INLINE uintptr_t ConvertKeyToMessage(ResumeKey key) {
static constexpr ALWAYS_INLINE uintptr_t ConvertKeyToMessage(ResumeKey key) {
static_assert(sizeof(key) <= sizeof(uintptr_t));
static_assert(std::is_trivial<ResumeKey>::value);
/* TODO: std::bit_cast */
uintptr_t converted = 0;
std::memcpy(std::addressof(converted), std::addressof(key), sizeof(key));
return converted;
if constexpr (sizeof(key) == sizeof(uintptr_t)) {
return std::bit_cast<uintptr_t>(key);
} else {
uintptr_t converted = 0;
std::memcpy(std::addressof(converted), std::addressof(key), sizeof(key));
return converted;
}
}
static ALWAYS_INLINE ResumeKey ConvertMessageToKey(uintptr_t message) {
static constexpr ALWAYS_INLINE ResumeKey ConvertMessageToKey(uintptr_t message) {
static_assert(sizeof(ResumeKey) <= sizeof(uintptr_t));
static_assert(std::is_trivial<ResumeKey>::value);
/* TODO: std::bit_cast */
ResumeKey converted = {};
std::memcpy(std::addressof(converted), std::addressof(message), sizeof(converted));
return converted;
if constexpr (sizeof(ResumeKey) == sizeof(uintptr_t)) {
return std::bit_cast<ResumeKey>(message);
} else {
ResumeKey converted = {};
std::memcpy(std::addressof(converted), std::addressof(message), sizeof(converted));
return converted;
}
}
template<size_t Ix> requires (Ix < NumPorts)