[common] replace Common::BitSet with std::bitset (#2576)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: #2576 Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
4982dcfaa5
commit
020ad29a8c
3 changed files with 18 additions and 98 deletions
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -5,10 +8,11 @@
|
|||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <bitset>
|
||||
#include <concepts>
|
||||
#include <cstddef>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/bit_set.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/concepts.h"
|
||||
|
||||
|
@ -159,7 +163,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].PushBack(core, member)) {
|
||||
m_available_priorities[core].SetBit(priority);
|
||||
m_available_priorities[core].set(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +176,7 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].PushFront(core, member)) {
|
||||
m_available_priorities[core].SetBit(priority);
|
||||
m_available_priorities[core].set(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,14 +189,14 @@ public:
|
|||
}
|
||||
|
||||
if (m_queues[priority].Remove(core, member)) {
|
||||
m_available_priorities[core].ClearBit(priority);
|
||||
m_available_priorities[core].reset(std::size_t(priority));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr Member* GetFront(s32 core) const {
|
||||
ASSERT(IsValidCore(core));
|
||||
|
||||
const s32 priority = static_cast<s32>(m_available_priorities[core].CountLeadingZero());
|
||||
const s32 priority = s32((~m_available_priorities[core]).count());
|
||||
if (priority <= LowestPriority) {
|
||||
return m_queues[priority].GetFront(core);
|
||||
} else {
|
||||
|
@ -216,11 +220,14 @@ public:
|
|||
|
||||
Member* next = member->GetPriorityQueueEntry(core).GetNext();
|
||||
if (next == nullptr) {
|
||||
const s32 priority = static_cast<s32>(
|
||||
m_available_priorities[core].GetNextSet(member->GetPriority()));
|
||||
if (priority <= LowestPriority) {
|
||||
next = m_queues[priority].GetFront(core);
|
||||
}
|
||||
s32 priority = member->GetPriority() + 1;
|
||||
do {
|
||||
if (m_available_priorities[core][priority]) {
|
||||
next = m_queues[priority].GetFront(core);
|
||||
break;
|
||||
}
|
||||
++priority;
|
||||
} while (priority <= LowestPriority && priority < s32(m_available_priorities[core].size()));
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
@ -250,7 +257,7 @@ public:
|
|||
|
||||
private:
|
||||
std::array<KPerCoreQueue, NumPriority> m_queues{};
|
||||
std::array<Common::BitSet64<NumPriority>, NumCores> m_available_priorities{};
|
||||
std::array<std::bitset<NumPriority>, NumCores> m_available_priorities{};
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue