diff options
author | rpj <rpj> | 2004-06-29 07:28:39 +0000 |
---|---|---|
committer | rpj <rpj> | 2004-06-29 07:28:39 +0000 |
commit | 0d83083f943f949cd92e8bc4de1ed5a793df9b83 (patch) | |
tree | c6f03ebd879862f7c606196e1f245f6f4650763a /ptw32_InterlockedCompareExchange.c | |
parent | 68cd86f6b75c45ac0421e55f955c9f967bd91445 (diff) |
Borland toolchain compatibilty
Diffstat (limited to 'ptw32_InterlockedCompareExchange.c')
-rw-r--r-- | ptw32_InterlockedCompareExchange.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ptw32_InterlockedCompareExchange.c b/ptw32_InterlockedCompareExchange.c index 0980710..299fc36 100644 --- a/ptw32_InterlockedCompareExchange.c +++ b/ptw32_InterlockedCompareExchange.c @@ -85,15 +85,32 @@ ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, POP ecx } +#elif defined(__BORLANDC__) + + _asm { + PUSH ecx + PUSH edx + MOV ecx,dword ptr [location] + MOV edx,dword ptr [value] + MOV eax,dword ptr [comparand] + LOCK CMPXCHG dword ptr [ecx],edx /* if (EAX == [ECX]) */ + /* [ECX] = EDX */ + /* else */ + /* EAX = [ECX] */ + MOV dword ptr [result], eax + POP edx + POP ecx + } + #elif defined(__GNUC__) __asm__ ( "lock\n\t" - "cmpxchgl %3,(%0)" /* if (EAX == [location]), */ + "cmpxchgl %3,(%0)" /* if (EAX == [location]) */ /* [location] = value */ /* else */ - /* EAX = [location] */ + /* EAX = [location] */ :"=r" (location), "=a" (result) :"0" (location), "q" (value), "a" (comparand) : "memory" ); |