14 static_assert(
sizeof(T) ==
sizeof(std::atomic<T>),
"Unexpected atomic size");
15 static_assert(
alignof(T) ==
alignof(std::atomic<T>),
"Unexpected atomic alignment");
29 static_assert(
sizeof(
int8) ==
sizeof(
char) &&
alignof(
int8) ==
alignof(
char),
"int8 must be compatible with char");
30 static_assert(
sizeof(
int16) ==
sizeof(
short) &&
alignof(
int16) ==
alignof(
short),
"int16 must be compatible with short");
31 static_assert(
sizeof(
int32) ==
sizeof(
long) &&
alignof(
int32) ==
alignof(
long),
"int32 must be compatible with long");
32 static_assert(
sizeof(
int64) ==
sizeof(
long long) &&
alignof(
int64) ==
alignof(
long long),
"int64 must be compatible with long long");
164 #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
165 if (
IsAligned(Dest,
alignof(
void*)) ==
false)
167 HandleAtomicsFailure(
TEXT(
"InterlockedExchangePointer requires Dest pointer to be aligned to %d bytes"), (
int)
alignof(
void*));
171 return ::_InterlockedExchangePointer(Dest,
Exchange);
191 #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
299 return ((std::atomic<int8>*)(Src))->load();
304 return ((std::atomic<int16>*)(Src))->load();
309 return ((std::atomic<int32>*)(Src))->load();
314 return ((std::atomic<int64>*)(Src))->load();
319 return ((std::atomic<int8>*)(Src))->load(std::memory_order_relaxed);
324 return ((std::atomic<int16>*)(Src))->load(std::memory_order_relaxed);
329 return ((std::atomic<int32>*)(Src))->load(std::memory_order_relaxed);
335 return ((std::atomic<int64>*)(Src))->load(std::memory_order_relaxed);
343 ((std::atomic<int8>*)(Src))->store(
Val);
348 ((std::atomic<int16>*)(Src))->store(
Val);
353 ((std::atomic<int32>*)(Src))->store(
Val);
358 ((std::atomic<int64>*)(Src))->store(
Val);
363 ((std::atomic<int8>*)(Src))->store(
Val, std::memory_order_relaxed);
368 ((std::atomic<int16>*)(Src))->store(
Val, std::memory_order_relaxed);
373 ((std::atomic<int32>*)(Src))->store(
Val, std::memory_order_relaxed);
379 ((std::atomic<int64>*)(Src))->store(
Val, std::memory_order_relaxed);
395#if PLATFORM_HAS_128BIT_ATOMICS
398#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
427 #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
428 if (
IsAligned(Dest,
alignof(
void*)) ==
false)
430 HandleAtomicsFailure(
TEXT(
"InterlockedCompareExchangePointer requires Dest pointer to be aligned to %d bytes"), (
int)
alignof(
void*));
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define WINDOWS_PF_COMPARE_EXCHANGE128
Definition MinimalWindowsApi.h:55
float Val(const FString &Value)
Definition UnrealMath.cpp:3163
UE_REWRITE constexpr void Exchange(T &A, T &B)
Definition UnrealTemplate.h:627
Definition WindowsPlatformAtomics.h:13
MINIMAL_WINDOWS_API BOOL WINAPI IsProcessorFeaturePresent(DWORD ProcessorFeature)