From 9da8fdcb33373b4b2e1de2a8b7af3ed4b5811245 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 8 Oct 2004 12:03:18 +0000 Subject: Mutex speedups --- ptw32_InterlockedCompareExchange.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ptw32_InterlockedCompareExchange.c') diff --git a/ptw32_InterlockedCompareExchange.c b/ptw32_InterlockedCompareExchange.c index 299fc36..e3c5162 100644 --- a/ptw32_InterlockedCompareExchange.c +++ b/ptw32_InterlockedCompareExchange.c @@ -51,7 +51,7 @@ * we can call it through a pointer. */ -PTW32_INTERLOCKED_LONG WINAPI +INLINE PTW32_INTERLOCKED_LONG WINAPI ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, PTW32_INTERLOCKED_LONG value, PTW32_INTERLOCKED_LONG comparand) @@ -69,6 +69,7 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, #if defined(_M_IX86) || defined(_X86_) #if defined(_MSC_VER) || defined(__WATCOMC__) +#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG _asm { PUSH ecx @@ -86,6 +87,7 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, } #elif defined(__BORLANDC__) +#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG _asm { PUSH ecx @@ -103,6 +105,7 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, } #elif defined(__GNUC__) +#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG __asm__ ( @@ -139,3 +142,10 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, #endif } + +#if 0 +#if defined(PTW32_BUILD_INLINED) && defined(HAVE_INLINABLE_INTERLOCKED_CMPXCHG) +#undef PTW32_INTERLOCKED_COMPARE_EXCHANGE +#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_InterlockedCompareExchange +#endif +#endif -- cgit v1.2.3