From d7ff4aa50237aa790857fbb8a28636afc80d16fc Mon Sep 17 00:00:00 2001 From: Wenju He Date: Thu, 25 Jul 2019 01:54:00 +0800 Subject: [PATCH] SVM: use InterlockedCompareExchange64 for 64-bit type (#397) --- test_conformance/SVM/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_conformance/SVM/common.h b/test_conformance/SVM/common.h index a3761ee8..b5cbc8f1 100644 --- a/test_conformance/SVM/common.h +++ b/test_conformance/SVM/common.h @@ -44,7 +44,8 @@ bool AtomicCompareExchangeStrongExplicit(volatile T *a, T *expected, T desired, { T tmp; #if defined( _MSC_VER ) || (defined( __INTEL_COMPILER ) && defined(WIN32)) - tmp = (T)InterlockedCompareExchange((volatile LONG *)a, (LONG)desired, *(LONG *)expected); + tmp = (sizeof(void*) == 8) ? (T)InterlockedCompareExchange64((volatile LONG64 *)a, (LONG64)desired, *(LONG64 *)expected) : + (T)InterlockedCompareExchange((volatile LONG*)a, (LONG)desired, *(LONG*)expected); #elif defined(__GNUC__) tmp = (T)__sync_val_compare_and_swap((volatile intptr_t*)a, (intptr_t)(*expected), (intptr_t)desired); #else