mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 19:28:43 +12:00
types.hpp: implement smin, smax, amin, amax
Rewritten the following global utility constants: `umax` returns max number, restricted to unsigned. `smax` returns max signed number, restricted to integrals. `smin` returns min signed number, restricted to signed. `amin` returns smin or zero, less restricted. `amax` returns smax or umax, less restricted. Fix operators == and <=> for synthesized rel-ops.
This commit is contained in:
parent
613777afde
commit
160b131de3
38 changed files with 219 additions and 111 deletions
|
@ -52,7 +52,7 @@ error_code _sys_lwmutex_destroy(ppu_thread& ppu, u32 lwmutex_id)
|
|||
if (std::scoped_lock lock(mutex->mutex); mutex->sq.empty())
|
||||
{
|
||||
// Set "destroyed" bit
|
||||
if (mutex->lwcond_waiters.fetch_or(INT32_MIN) & 0x7fff'ffff)
|
||||
if (mutex->lwcond_waiters.fetch_or(smin) & 0x7fff'ffff)
|
||||
{
|
||||
// Deschedule if waiters were found
|
||||
lv2_obj::sleep(ppu);
|
||||
|
@ -64,7 +64,7 @@ error_code _sys_lwmutex_destroy(ppu_thread& ppu, u32 lwmutex_id)
|
|||
}
|
||||
|
||||
// Wait for all lwcond waiters to quit
|
||||
if (const s32 old = mutex->lwcond_waiters; old != INT32_MIN)
|
||||
if (const s32 old = mutex->lwcond_waiters; old != smin)
|
||||
{
|
||||
if (old >= 0)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
|
|||
|
||||
if (old)
|
||||
{
|
||||
if (old == INT32_MIN)
|
||||
if (old == smin)
|
||||
{
|
||||
ppu.gpr[3] = CELL_EBUSY;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ error_code _sys_lwmutex_unlock2(ppu_thread& ppu, u32 lwmutex_id)
|
|||
return;
|
||||
}
|
||||
|
||||
mutex.signaled |= INT32_MIN;
|
||||
mutex.signaled |= smin;
|
||||
});
|
||||
|
||||
if (!mutex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue