mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 17:14:28 -04:00
kern: use optimized red black tree finds for remaining holdouts
This commit is contained in:
parent
436613401a
commit
89926f44c6
5 changed files with 36 additions and 37 deletions
|
@ -248,10 +248,16 @@ namespace ams::kern {
|
|||
public:
|
||||
constexpr ALWAYS_INLINE KAutoObjectWithList(util::ConstantInitializeTag) : KAutoObjectWithListBase(util::ConstantInitialize), m_list_node(util::ConstantInitialize) { /* ... */ }
|
||||
ALWAYS_INLINE explicit KAutoObjectWithList() { /* ... */ }
|
||||
public:
|
||||
using RedBlackKeyType = u64;
|
||||
|
||||
static ALWAYS_INLINE int Compare(const KAutoObjectWithList &lhs, const KAutoObjectWithList &rhs) {
|
||||
const u64 lid = lhs.GetId();
|
||||
const u64 rid = rhs.GetId();
|
||||
static constexpr ALWAYS_INLINE RedBlackKeyType GetRedBlackKey(const RedBlackKeyType &v) { return v; }
|
||||
static constexpr ALWAYS_INLINE RedBlackKeyType GetRedBlackKey(const KAutoObjectWithList &v) { return v.GetId(); }
|
||||
|
||||
template<typename T> requires (std::same_as<T, KAutoObjectWithList> || std::same_as<T, RedBlackKeyType>)
|
||||
static ALWAYS_INLINE int Compare(const T &lhs, const KAutoObjectWithList &rhs) {
|
||||
const u64 lid = GetRedBlackKey(lhs);
|
||||
const u64 rid = GetRedBlackKey(rhs);
|
||||
|
||||
if (lid < rid) {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue