diff --git a/Source/Engine/Platform/Android/AndroidPlatform.h b/Source/Engine/Platform/Android/AndroidPlatform.h
index 03b56798f..4d8955627 100644
--- a/Source/Engine/Platform/Android/AndroidPlatform.h
+++ b/Source/Engine/Platform/Android/AndroidPlatform.h
@@ -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);
diff --git a/Source/Engine/Platform/Apple/ApplePlatform.h b/Source/Engine/Platform/Apple/ApplePlatform.h
index 69576b5a9..9f0fddebf 100644
--- a/Source/Engine/Platform/Apple/ApplePlatform.h
+++ b/Source/Engine/Platform/Apple/ApplePlatform.h
@@ -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)
{
diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h
index 7c6640843..35cfd8d17 100644
--- a/Source/Engine/Platform/Base/PlatformBase.h
+++ b/Source/Engine/Platform/Base/PlatformBase.h
@@ -270,14 +270,14 @@ public:
///
/// A pointer to the destination value.
/// The function returns the value of the destination parameter.
- static int32 AtomicRead(int32 volatile* dst) = delete;
+ static int32 AtomicRead(int32 const volatile* dst) = delete;
///
/// Performs an atomic 64-bit variable read operation on the specified values.
///
/// A pointer to the destination value.
/// The function returns the value of the destination parameter.
- static int64 AtomicRead(int64 volatile* dst) = delete;
+ static int64 AtomicRead(int64 const volatile* dst) = delete;
///
/// Sets a 32-bit variable to the specified value as an atomic operation.
diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.h b/Source/Engine/Platform/Linux/LinuxPlatform.h
index 73cf327a8..10c81f436 100644
--- a/Source/Engine/Platform/Linux/LinuxPlatform.h
+++ b/Source/Engine/Platform/Linux/LinuxPlatform.h
@@ -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);
diff --git a/Source/Engine/Platform/Win32/Win32Platform.h b/Source/Engine/Platform/Win32/Win32Platform.h
index 4e66de99d..9eb1c4c1e 100644
--- a/Source/Engine/Platform/Win32/Win32Platform.h
+++ b/Source/Engine/Platform/Win32/Win32Platform.h
@@ -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);
}