From 4431b499d0f1fc59b19332ceb428fbca0e9d00b5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Feb 2021 14:54:06 -0500 Subject: [PATCH 1/3] k_priority_queue: Resolved reserved identifier An identifier containing a starting underscore followed by a capital letter is reserved by the standard. It's trivial to avoid this by moving the underscore to the end of the identifier. While the likelihood of clashing here being minimal, we can turn a "should not break" scenario into a definitive "will not break" one, so why not?. --- src/core/hle/kernel/k_priority_queue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index 13d628b85a..afaab98126 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -55,7 +55,7 @@ concept KPriorityQueueMember = !std::is_reference_v && requires(T & t) { ->Common::ConvertibleTo; }; -template +template requires KPriorityQueueMember class KPriorityQueue { public: using AffinityMaskType = typename std::remove_cv_t< @@ -65,7 +65,7 @@ public: static_assert(HighestPriority >= 0); static_assert(LowestPriority >= HighestPriority); static constexpr size_t NumPriority = LowestPriority - HighestPriority + 1; - static constexpr size_t NumCores = _NumCores; + static constexpr size_t NumCores = NumCores_; static constexpr bool IsValidCore(s32 core) { return 0 <= core && core < static_cast(NumCores); From 8170435ec57f0caa48929346b58bc1169b170e28 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Feb 2021 14:57:36 -0500 Subject: [PATCH 2/3] k_priority_queue: Simplify affinity mask type alias We can make use of the _t variants of the templates to cut down on a little bit of verbosity. --- src/core/hle/kernel/k_priority_queue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index afaab98126..103dafd48b 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -58,8 +58,8 @@ concept KPriorityQueueMember = !std::is_reference_v && requires(T & t) { template requires KPriorityQueueMember class KPriorityQueue { public: - using AffinityMaskType = typename std::remove_cv_t< - typename std::remove_reference().GetAffinityMask())>::type>; + using AffinityMaskType = std::remove_cv_t< + std::remove_reference_t().GetAffinityMask())>>; static_assert(LowestPriority >= 0); static_assert(HighestPriority >= 0); From 9fb1a476589f083623fe94089630d5825dd03f59 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 4 Feb 2021 15:11:19 -0500 Subject: [PATCH 3/3] k_priority_queue: Unfold several declval usages Given these are only used as function existence checks, we can simplify some usages of declval, given they aren't particularly useful here. Reduces a few template instantiations, which at most reduces compile times a tiny bit. --- src/core/hle/kernel/k_priority_queue.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index 103dafd48b..4aa669d956 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -24,11 +24,11 @@ template concept KPriorityQueueAffinityMask = !std::is_reference_v && requires(T & t) { { t.GetAffinityMask() } ->Common::ConvertibleTo; - {t.SetAffinityMask(std::declval())}; + {t.SetAffinityMask(0)}; - { t.GetAffinity(std::declval()) } + { t.GetAffinity(0) } ->std::same_as; - {t.SetAffinity(std::declval(), std::declval())}; + {t.SetAffinity(0, false)}; {t.SetAll()}; }; @@ -42,11 +42,11 @@ concept KPriorityQueueMember = !std::is_reference_v && requires(T & t) { ->std::same_as; { (typename T::QueueEntry()).GetPrev() } ->std::same_as; - { t.GetPriorityQueueEntry(std::declval()) } + { t.GetPriorityQueueEntry(0) } ->std::same_as; {t.GetAffinityMask()}; - { typename std::remove_cvref::type() } + { std::remove_cvref_t() } ->KPriorityQueueAffinityMask; { t.GetActiveCore() }