[*] These atomic set utils were stupid

This commit is contained in:
Reece Wilson 2023-03-27 05:44:29 +01:00
parent 58ffac4672
commit f081fc6242

View File

@ -377,16 +377,31 @@ inline auline bool AuAtomicUtils<AuInt64>::TestAndSet(AuInt64 *in, const AuUInt8
template <class T>
auline
T AuAtomicSet(T *in, AuUInt8 offset)
T AuAtomicOrSetBit(T *in, AuUInt8 offset)
{
return AuAtomicUtils<T>::Set(in, offset);
}
template <class T>
auline
bool AuAtomicSet(T *in, AuUInt8 offset)
{
return AuAtomicOrSetBit(in, offset) & (T(1) << offset);
}
template <class T>
auline
T AuAtomicAndUnsetBit(T *in, AuUInt8 offset)
{
return AuAtomicUtils<T>::And(in, ~(T(1) << T(offset)));
}
template <class T>
auline
bool AuAtomicUnset(T *in, AuUInt8 offset)
{
return AuAtomicUtils<T>::And(in, ~(1u << AuUInt32(offset))) != 0;
auto uBit = T(1) << T(offset);
return AuAtomicUtils<T>::And(in, ~(uBit)) & uBit;
}
template <class T>