summaryrefslogtreecommitdiff
path: root/ptw32_InterlockedCompareExchange.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-10-08 12:03:18 +0000
committerrpj <rpj>2004-10-08 12:03:18 +0000
commit9da8fdcb33373b4b2e1de2a8b7af3ed4b5811245 (patch)
tree1e232efaa8472fbf0d61816995cb4fddc7e9b5ed /ptw32_InterlockedCompareExchange.c
parentb0cf9efa6afeb8a7dbddf124dae173a2d633c801 (diff)
Mutex speedups
Diffstat (limited to 'ptw32_InterlockedCompareExchange.c')
-rw-r--r--ptw32_InterlockedCompareExchange.c12
1 files changed, 11 insertions, 1 deletions
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