mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
[orbis-kernel] Optimize kalloc a bit
This commit is contained in:
parent
389627ff73
commit
d273e649bd
|
|
@ -85,7 +85,10 @@ void *KernelContext::kalloc(std::size_t size, std::size_t align) {
|
|||
for (auto [it, end] = m_free_heap.equal_range(size); it != end; it++) {
|
||||
auto result = it->second;
|
||||
if (!(reinterpret_cast<std::uintptr_t>(result) & (align - 1))) {
|
||||
m_used_node.insert(m_free_heap.extract(it));
|
||||
auto node = m_free_heap.extract(it);
|
||||
node.key() = 0;
|
||||
node.mapped() = nullptr;
|
||||
m_used_node.insert(m_used_node.begin(), std::move(node));
|
||||
pthread_mutex_unlock(&m_heap_mtx);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue