From 633e5c0e05852f1c7762797027ff0247424a57bd Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Tue, 13 Jun 2023 18:32:46 +0200 Subject: [PATCH] Fix incorrect return values in OSAtomic --- src/Cafe/OS/libs/coreinit/coreinit_Atomic.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Atomic.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Atomic.cpp index 6ac781c0..accce552 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Atomic.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Atomic.cpp @@ -33,10 +33,11 @@ namespace coreinit uint32 OSAddAtomic(std::atomic* mem, uint32 adder) { + // used by SDL Wii U port uint32be knownValue; while (true) { - uint32be knownValue = mem->load(); + knownValue = mem->load(); uint32be newValue = knownValue + adder; if (mem->compare_exchange_strong(knownValue, newValue)) break; @@ -68,7 +69,7 @@ namespace coreinit uint64be knownValue; while (true) { - uint64be knownValue = mem->load(); + knownValue = mem->load(); uint64be newValue = knownValue + adder; if (mem->compare_exchange_strong(knownValue, newValue)) break; @@ -81,7 +82,7 @@ namespace coreinit uint64be knownValue; while (true) { - uint64be knownValue = mem->load(); + knownValue = mem->load(); uint64be newValue = knownValue & val; if (mem->compare_exchange_strong(knownValue, newValue)) break; @@ -94,7 +95,7 @@ namespace coreinit uint64be knownValue; while (true) { - uint64be knownValue = mem->load(); + knownValue = mem->load(); uint64be newValue = knownValue | val; if (mem->compare_exchange_strong(knownValue, newValue)) break;