From 122fc74a669596e200481ada884497854d07c5d1 Mon Sep 17 00:00:00 2001 From: Reece Wilson Date: Thu, 17 Nov 2022 23:26:48 +0000 Subject: [PATCH] [+] Atomic: Missing int32/64 msvc atomic decs [*] Atomic: Normalize away externally-volatile attribute --- Include/auROXTL/auAtomic.hpp | 66 ++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/Include/auROXTL/auAtomic.hpp b/Include/auROXTL/auAtomic.hpp index 440b6c1..c041773 100644 --- a/Include/auROXTL/auAtomic.hpp +++ b/Include/auROXTL/auAtomic.hpp @@ -146,6 +146,18 @@ inline auline AuUInt32 AuAtomicUtils::Sub(AuUInt32 *in, AuUInt32 minue return Add(in, AuUInt32(0) - minuend); } +template <> +inline auline AuInt64 AuAtomicUtils::Sub(AuInt64 *in, AuInt64 minuend) +{ + return Add(in, AuInt64(0) - minuend); +} + +template <> +inline auline AuInt32 AuAtomicUtils::Sub(AuInt32 *in, AuInt32 minuend) +{ + return Add(in, AuInt32(0) - minuend); +} + // TODO: #if 0 template <> @@ -300,40 +312,82 @@ template auline T AuAtomicSet(T *in, AuUInt8 offset) { - return AuAtomicUtils>::Set(in, offset); + return AuAtomicUtils::Set(in, offset); } template auline T AuAtomicOr(T *in, T value) { - return AuAtomicUtils>::Or(in, value); + return AuAtomicUtils::Or(in, value); } template auline T AuAtomicAdd(T *in, T addend) { - return AuAtomicUtils>::Add(in, addend); + return AuAtomicUtils::Add(in, addend); } template auline T AuAtomicSub(T *in, T minuend) { - return AuAtomicUtils>::Sub(in, minuend); + return AuAtomicUtils::Sub(in, minuend); } template auline T AuAtomicCompareExchange(T *in, T replace, T compare) { - return AuAtomicUtils>::CompareExchange(in, replace, compare); + return AuAtomicUtils::CompareExchange(in, replace, compare); } template auline bool AuAtomicTestAndSet(T *in, AuUInt8 offset) { - return AuAtomicUtils>::TestAndSet(in, offset); + return AuAtomicUtils::TestAndSet(in, offset); +} + +template +auline +T AuAtomicSet(volatile T *in, AuUInt8 offset) +{ + return AuAtomicUtils::Set(reinterpret_cast(in), offset); +} + +template +auline +T AuAtomicOr(volatile T *in, T value) +{ + return AuAtomicUtils::Or(reinterpret_cast(in), value); +} + +template +auline +T AuAtomicAdd(volatile T *in, T addend) +{ + return AuAtomicUtils::Add(reinterpret_cast(in), addend); +} + +template +auline +T AuAtomicSub(volatile T *in, T minuend) +{ + return AuAtomicUtils::Sub(reinterpret_cast(in), minuend); +} + +template +auline +T AuAtomicCompareExchange(volatile T *in, T replace, T compare) +{ + return AuAtomicUtils::CompareExchange(reinterpret_cast(in), replace, compare); +} + +template +auline +bool AuAtomicTestAndSet(volatile T *in, AuUInt8 offset) +{ + return AuAtomicUtils::TestAndSet(reinterpret_cast(in), offset); } \ No newline at end of file