Browse Source

fix for vs 2013 (#175)

https://github.com/bkaradzic/bgfx/issues/1261
attilaz 8 years ago
parent
commit
5c2f44354e
1 changed files with 15 additions and 0 deletions
  1. 15 0
      include/bx/inline/cpu.inl

+ 15 - 0
include/bx/inline/cpu.inl

@@ -35,9 +35,24 @@ extern "C" long _InterlockedCompareExchange(long volatile* _ptr, long _exchange,
 extern "C" int64_t _InterlockedCompareExchange64(int64_t volatile* _ptr, int64_t _exchange, int64_t _comparand);
 extern "C" int64_t _InterlockedCompareExchange64(int64_t volatile* _ptr, int64_t _exchange, int64_t _comparand);
 #	pragma intrinsic(_InterlockedCompareExchange64)
 #	pragma intrinsic(_InterlockedCompareExchange64)
 
 
+#if (_MSC_VER == 1800) && !defined(FIXED_592562) && defined (_M_IX86) && !defined (_M_CEE_PURE)
+
+extern "C" long _InterlockedExchange(long volatile* _ptr, long _value);
+#	pragma intrinsic(_InterlockedExchange)
+
+__forceinline static void * _InterlockedExchangePointer_impl(void * volatile * _Target, void * _Value)
+{
+    return (void *)_InterlockedExchange((long volatile *) _Target, (long) _Value);
+}
+#define _InterlockedExchangePointer(p,v)  _InterlockedExchangePointer_impl(p,v)
+
+#else
+
 extern "C" void* _InterlockedExchangePointer(void* volatile* _ptr, void* _value);
 extern "C" void* _InterlockedExchangePointer(void* volatile* _ptr, void* _value);
 #	pragma intrinsic(_InterlockedExchangePointer)
 #	pragma intrinsic(_InterlockedExchangePointer)
 
 
+#endif
+
 #	if BX_PLATFORM_WINRT
 #	if BX_PLATFORM_WINRT
 #		define _InterlockedExchangeAdd64 InterlockedExchangeAdd64
 #		define _InterlockedExchangeAdd64 InterlockedExchangeAdd64
 #	endif // BX_PLATFORM_WINRT
 #	endif // BX_PLATFORM_WINRT