mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-22 06:45:55 +01:00
21 lines
666 B
Plaintext
21 lines
666 B
Plaintext
|
int Helper_AtomicMaxS32(int index, int offset, int value)
|
||
|
{
|
||
|
uint oldValue, newValue;
|
||
|
do
|
||
|
{
|
||
|
oldValue = $STORAGE_MEM$[index].data[offset];
|
||
|
newValue = uint(max(int(oldValue), value));
|
||
|
} while (atomicCompSwap($STORAGE_MEM$[index].data[offset], newValue, oldValue) != oldValue);
|
||
|
return int(oldValue);
|
||
|
}
|
||
|
|
||
|
int Helper_AtomicMinS32(int index, int offset, int value)
|
||
|
{
|
||
|
uint oldValue, newValue;
|
||
|
do
|
||
|
{
|
||
|
oldValue = $STORAGE_MEM$[index].data[offset];
|
||
|
newValue = uint(min(int(oldValue), value));
|
||
|
} while (atomicCompSwap($STORAGE_MEM$[index].data[offset], newValue, oldValue) != oldValue);
|
||
|
return int(oldValue);
|
||
|
}
|