[+] Atomic load/store pointer

This commit is contained in:
Reece Wilson 2024-03-18 07:12:21 +00:00
parent 58d572d52f
commit 9dcb7ca673

View File

@ -428,6 +428,11 @@ inline auline T AuAtomicUtils<T>::LoadWeak(T *in)
template <class T> template <class T>
inline auline T AuAtomicUtils<T>::Load(T *in) inline auline T AuAtomicUtils<T>::Load(T *in)
{ {
if constexpr (AuIsPointer_v<T>)
{
return (T)AuAtomicUtils<AuUInt>::Load((AuUInt *)in);
}
#if defined(AURORA_COMPILER_MSVC) && (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)) #if defined(AURORA_COMPILER_MSVC) && (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
const auto read = *in; const auto read = *in;
::_ReadWriteBarrier(); ::_ReadWriteBarrier();
@ -486,6 +491,12 @@ inline auline T AuAtomicUtils<T>::Load(T *in)
template <class T> template <class T>
inline auline void AuAtomicUtils<T>::Store(T *in, T val) inline auline void AuAtomicUtils<T>::Store(T *in, T val)
{ {
if constexpr (AuIsPointer_v<T>)
{
AuAtomicUtils<AuUInt>::Store((AuUInt *)in, (AuUInt)val);
return;
}
#if defined(AURORA_COMPILER_MSVC) && (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86)) #if defined(AURORA_COMPILER_MSVC) && (defined(AURORA_ARCH_X64) || defined(AURORA_ARCH_X86))
*in = val; *in = val;
#elif defined(AURORA_COMPILER_MSVC) #elif defined(AURORA_COMPILER_MSVC)