mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
Replace utils::cntlz{32,64} with std::countl_zero
This commit is contained in:
parent
d0c199d455
commit
032e7c0491
11 changed files with 22 additions and 47 deletions
|
|
@ -5,7 +5,6 @@
|
|||
#endif
|
||||
|
||||
#include "Utilities/sync.h"
|
||||
#include "Utilities/asm.h"
|
||||
|
||||
#ifdef USE_POSIX
|
||||
#include <semaphore.h>
|
||||
|
|
@ -141,7 +140,7 @@ static sync_var* slot_get(std::uintptr_t iptr, sync_var* loc, u64 lv = 0)
|
|||
}
|
||||
|
||||
// Get the number of leading equal bits to determine subslot
|
||||
const u64 eq_bits = utils::cntlz64((((iptr ^ value) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16, true);
|
||||
const u64 eq_bits = std::countl_zero<u64>((((iptr ^ value) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16);
|
||||
|
||||
// Proceed recursively, increment level
|
||||
return slot_get(iptr, s_slot_list[(value & s_slot_mask) / one_v<s_slot_mask>].branch + eq_bits, eq_bits + 1);
|
||||
|
|
@ -166,7 +165,7 @@ static void slot_free(std::uintptr_t iptr, sync_var* loc, u64 lv = 0)
|
|||
}
|
||||
|
||||
// Get the number of leading equal bits to determine subslot
|
||||
const u64 eq_bits = utils::cntlz64((((iptr ^ value) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16, true);
|
||||
const u64 eq_bits = std::countl_zero<u64>((((iptr ^ value) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16);
|
||||
|
||||
// Proceed recursively, to deallocate deepest branch first
|
||||
slot_free(iptr, s_slot_list[(value & s_slot_mask) / one_v<s_slot_mask>].branch + eq_bits, eq_bits + 1);
|
||||
|
|
@ -445,7 +444,7 @@ void atomic_storage_futex::wait(const void* data, std::size_t size, u64 old_valu
|
|||
}
|
||||
|
||||
// Get the number of leading equal bits (between iptr and slot owner)
|
||||
const u64 eq_bits = utils::cntlz64((((iptr ^ ok) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16, true);
|
||||
const u64 eq_bits = std::countl_zero<u64>((((iptr ^ ok) & (s_pointer_mask >> lv)) | ~s_pointer_mask) << 16);
|
||||
|
||||
// Collision; need to go deeper
|
||||
ptr = s_slot_list[(ok & s_slot_mask) / one_v<s_slot_mask>].branch + eq_bits;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue