mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 00:40:58 +01:00
Merge pull request #5875 from lioncash/identifier
k_priority_queue: Minor cleanup
This commit is contained in:
commit
3a804752cb
1 changed files with 9 additions and 9 deletions
|
@ -24,11 +24,11 @@ template <typename T>
|
||||||
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) {
|
concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) {
|
||||||
{ t.GetAffinityMask() }
|
{ t.GetAffinityMask() }
|
||||||
->Common::ConvertibleTo<u64>;
|
->Common::ConvertibleTo<u64>;
|
||||||
{t.SetAffinityMask(std::declval<u64>())};
|
{t.SetAffinityMask(0)};
|
||||||
|
|
||||||
{ t.GetAffinity(std::declval<int32_t>()) }
|
{ t.GetAffinity(0) }
|
||||||
->std::same_as<bool>;
|
->std::same_as<bool>;
|
||||||
{t.SetAffinity(std::declval<int32_t>(), std::declval<bool>())};
|
{t.SetAffinity(0, false)};
|
||||||
{t.SetAll()};
|
{t.SetAll()};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) {
|
||||||
->std::same_as<T*>;
|
->std::same_as<T*>;
|
||||||
{ (typename T::QueueEntry()).GetPrev() }
|
{ (typename T::QueueEntry()).GetPrev() }
|
||||||
->std::same_as<T*>;
|
->std::same_as<T*>;
|
||||||
{ t.GetPriorityQueueEntry(std::declval<s32>()) }
|
{ t.GetPriorityQueueEntry(0) }
|
||||||
->std::same_as<typename T::QueueEntry&>;
|
->std::same_as<typename T::QueueEntry&>;
|
||||||
|
|
||||||
{t.GetAffinityMask()};
|
{t.GetAffinityMask()};
|
||||||
{ typename std::remove_cvref<decltype(t.GetAffinityMask())>::type() }
|
{ std::remove_cvref_t<decltype(t.GetAffinityMask())>() }
|
||||||
->KPriorityQueueAffinityMask;
|
->KPriorityQueueAffinityMask;
|
||||||
|
|
||||||
{ t.GetActiveCore() }
|
{ t.GetActiveCore() }
|
||||||
|
@ -55,17 +55,17 @@ concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) {
|
||||||
->Common::ConvertibleTo<s32>;
|
->Common::ConvertibleTo<s32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Member, size_t _NumCores, int LowestPriority, int HighestPriority>
|
template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority>
|
||||||
requires KPriorityQueueMember<Member> class KPriorityQueue {
|
requires KPriorityQueueMember<Member> class KPriorityQueue {
|
||||||
public:
|
public:
|
||||||
using AffinityMaskType = typename std::remove_cv_t<
|
using AffinityMaskType = std::remove_cv_t<
|
||||||
typename std::remove_reference<decltype(std::declval<Member>().GetAffinityMask())>::type>;
|
std::remove_reference_t<decltype(std::declval<Member>().GetAffinityMask())>>;
|
||||||
|
|
||||||
static_assert(LowestPriority >= 0);
|
static_assert(LowestPriority >= 0);
|
||||||
static_assert(HighestPriority >= 0);
|
static_assert(HighestPriority >= 0);
|
||||||
static_assert(LowestPriority >= HighestPriority);
|
static_assert(LowestPriority >= HighestPriority);
|
||||||
static constexpr size_t NumPriority = LowestPriority - HighestPriority + 1;
|
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) {
|
static constexpr bool IsValidCore(s32 core) {
|
||||||
return 0 <= core && core < static_cast<s32>(NumCores);
|
return 0 <= core && core < static_cast<s32>(NumCores);
|
||||||
|
|
Loading…
Reference in a new issue