mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
Rewrite condition variables
Implement helper functions balanced_wait_until and balanced_awaken They include new path for Windows 8.1+ (WaitOnAddress) shared_mutex, cond_variable, cond_one, cond_x16 modified to use it Added helper function utils::popcnt16 Replace most semaphore<> with shared_mutex
This commit is contained in:
parent
f442a8a84c
commit
96cabeadff
23 changed files with 269 additions and 338 deletions
|
@ -44,6 +44,20 @@ namespace utils
|
|||
#endif
|
||||
}
|
||||
|
||||
inline u8 popcnt16(u16 arg)
|
||||
{
|
||||
const u32 a1 = arg & 0x5555;
|
||||
const u32 a2 = (arg >> 1) & 0x5555;
|
||||
const u32 a3 = a1 + a2;
|
||||
const u32 b1 = a3 & 0x3333;
|
||||
const u32 b2 = (a3 >> 2) & 0x3333;
|
||||
const u32 b3 = b1 + b2;
|
||||
const u32 c1 = b3 & 0x0f0f;
|
||||
const u32 c2 = (b3 >> 4) & 0x0f0f;
|
||||
const u32 c3 = c1 + c2;
|
||||
return static_cast<u8>(c3 + (c3 >> 8));
|
||||
}
|
||||
|
||||
// Rotate helpers
|
||||
#if defined(__GNUG__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue