Fix atomics to accept constant
This commit is contained in:
@@ -55,13 +55,13 @@ public:
|
||||
{
|
||||
return __sync_fetch_and_add(dst, value);
|
||||
}
|
||||
FORCE_INLINE static int32 AtomicRead(int32 volatile* dst)
|
||||
FORCE_INLINE static int32 AtomicRead(int32 const volatile* dst)
|
||||
{
|
||||
int32 result;
|
||||
__atomic_load(dst, &result, __ATOMIC_RELAXED);
|
||||
return result;
|
||||
}
|
||||
FORCE_INLINE static int64 AtomicRead(int64 volatile* dst)
|
||||
FORCE_INLINE static int64 AtomicRead(int64 const volatile* dst)
|
||||
{
|
||||
int64 result;
|
||||
__atomic_load(dst, &result, __ATOMIC_RELAXED);
|
||||
|
||||
@@ -45,21 +45,21 @@ public:
|
||||
{
|
||||
return __sync_fetch_and_add(dst, value);
|
||||
}
|
||||
FORCE_INLINE static int32 AtomicRead(int32 volatile* dst)
|
||||
FORCE_INLINE static int32 AtomicRead(int32 const volatile* dst)
|
||||
{
|
||||
return __atomic_load_n(dst, __ATOMIC_RELAXED);
|
||||
}
|
||||
FORCE_INLINE static int64 AtomicRead(int64 volatile* dst)
|
||||
FORCE_INLINE static int64 AtomicRead(int64 const volatile* dst)
|
||||
{
|
||||
return __atomic_load_n(dst, __ATOMIC_RELAXED);
|
||||
}
|
||||
FORCE_INLINE static void AtomicStore(int32 volatile* dst, int32 value)
|
||||
{
|
||||
__atomic_store(dst, &value, __ATOMIC_SEQ_CST);
|
||||
__atomic_store_n((volatile int32*)dst, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
FORCE_INLINE static void AtomicStore(int64 volatile* dst, int64 value)
|
||||
{
|
||||
__atomic_store(dst, &value, __ATOMIC_SEQ_CST);
|
||||
__atomic_store_n((volatile int64*)dst, value, __ATOMIC_RELAXED);
|
||||
}
|
||||
FORCE_INLINE static void Prefetch(void const* ptr)
|
||||
{
|
||||
|
||||
@@ -270,14 +270,14 @@ public:
|
||||
/// </summary>
|
||||
/// <param name="dst">A pointer to the destination value.</param>
|
||||
/// <returns>The function returns the value of the destination parameter.</returns>
|
||||
static int32 AtomicRead(int32 volatile* dst) = delete;
|
||||
static int32 AtomicRead(int32 const volatile* dst) = delete;
|
||||
|
||||
/// <summary>
|
||||
/// Performs an atomic 64-bit variable read operation on the specified values.
|
||||
/// </summary>
|
||||
/// <param name="dst">A pointer to the destination value.</param>
|
||||
/// <returns>The function returns the value of the destination parameter.</returns>
|
||||
static int64 AtomicRead(int64 volatile* dst) = delete;
|
||||
static int64 AtomicRead(int64 const volatile* dst) = delete;
|
||||
|
||||
/// <summary>
|
||||
/// Sets a 32-bit variable to the specified value as an atomic operation.
|
||||
|
||||
@@ -69,13 +69,13 @@ public:
|
||||
{
|
||||
return __sync_fetch_and_add(dst, value);
|
||||
}
|
||||
FORCE_INLINE static int32 AtomicRead(int32 volatile* dst)
|
||||
FORCE_INLINE static int32 AtomicRead(int32 const volatile* dst)
|
||||
{
|
||||
int32 result;
|
||||
__atomic_load(dst, &result, __ATOMIC_SEQ_CST);
|
||||
return result;
|
||||
}
|
||||
FORCE_INLINE static int64 AtomicRead(int64 volatile* dst)
|
||||
FORCE_INLINE static int64 AtomicRead(int64 const volatile* dst)
|
||||
{
|
||||
int64 result;
|
||||
__atomic_load(dst, &result, __ATOMIC_SEQ_CST);
|
||||
|
||||
@@ -63,11 +63,11 @@ public:
|
||||
return _interlockedexchangeadd64(dst, value);
|
||||
#endif
|
||||
}
|
||||
static int32 AtomicRead(int32 volatile* dst)
|
||||
static int32 AtomicRead(int32 const volatile* dst)
|
||||
{
|
||||
return (int32)_InterlockedCompareExchange((long volatile*)dst, 0, 0);
|
||||
}
|
||||
static int64 AtomicRead(int64 volatile* dst)
|
||||
static int64 AtomicRead(int64 const volatile* dst)
|
||||
{
|
||||
return _InterlockedCompareExchange64(dst, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user