mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 11:04:18 +01:00
Fix incorrect return values in OSAtomic
This commit is contained in:
parent
808d1bb424
commit
633e5c0e05
@ -33,10 +33,11 @@ namespace coreinit
|
|||||||
|
|
||||||
uint32 OSAddAtomic(std::atomic<uint32be>* mem, uint32 adder)
|
uint32 OSAddAtomic(std::atomic<uint32be>* mem, uint32 adder)
|
||||||
{
|
{
|
||||||
|
// used by SDL Wii U port
|
||||||
uint32be knownValue;
|
uint32be knownValue;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint32be knownValue = mem->load();
|
knownValue = mem->load();
|
||||||
uint32be newValue = knownValue + adder;
|
uint32be newValue = knownValue + adder;
|
||||||
if (mem->compare_exchange_strong(knownValue, newValue))
|
if (mem->compare_exchange_strong(knownValue, newValue))
|
||||||
break;
|
break;
|
||||||
@ -68,7 +69,7 @@ namespace coreinit
|
|||||||
uint64be knownValue;
|
uint64be knownValue;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint64be knownValue = mem->load();
|
knownValue = mem->load();
|
||||||
uint64be newValue = knownValue + adder;
|
uint64be newValue = knownValue + adder;
|
||||||
if (mem->compare_exchange_strong(knownValue, newValue))
|
if (mem->compare_exchange_strong(knownValue, newValue))
|
||||||
break;
|
break;
|
||||||
@ -81,7 +82,7 @@ namespace coreinit
|
|||||||
uint64be knownValue;
|
uint64be knownValue;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint64be knownValue = mem->load();
|
knownValue = mem->load();
|
||||||
uint64be newValue = knownValue & val;
|
uint64be newValue = knownValue & val;
|
||||||
if (mem->compare_exchange_strong(knownValue, newValue))
|
if (mem->compare_exchange_strong(knownValue, newValue))
|
||||||
break;
|
break;
|
||||||
@ -94,7 +95,7 @@ namespace coreinit
|
|||||||
uint64be knownValue;
|
uint64be knownValue;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint64be knownValue = mem->load();
|
knownValue = mem->load();
|
||||||
uint64be newValue = knownValue | val;
|
uint64be newValue = knownValue | val;
|
||||||
if (mem->compare_exchange_strong(knownValue, newValue))
|
if (mem->compare_exchange_strong(knownValue, newValue))
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user