diff --git a/Include/auROXTL/auAtomic.hpp b/Include/auROXTL/auAtomic.hpp index e061e47..d461443 100644 --- a/Include/auROXTL/auAtomic.hpp +++ b/Include/auROXTL/auAtomic.hpp @@ -377,16 +377,31 @@ inline auline bool AuAtomicUtils::TestAndSet(AuInt64 *in, const AuUInt8 template auline -T AuAtomicSet(T *in, AuUInt8 offset) +T AuAtomicOrSetBit(T *in, AuUInt8 offset) { return AuAtomicUtils::Set(in, offset); } +template +auline +bool AuAtomicSet(T *in, AuUInt8 offset) +{ + return AuAtomicOrSetBit(in, offset) & (T(1) << offset); +} + +template +auline +T AuAtomicAndUnsetBit(T *in, AuUInt8 offset) +{ + return AuAtomicUtils::And(in, ~(T(1) << T(offset))); +} + template auline bool AuAtomicUnset(T *in, AuUInt8 offset) { - return AuAtomicUtils::And(in, ~(1u << AuUInt32(offset))) != 0; + auto uBit = T(1) << T(offset); + return AuAtomicUtils::And(in, ~(uBit)) & uBit; } template