summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/Thread.cpp
diff options
context:
space:
mode:
authortmator <tmator@gmail.com>2008-10-17 11:12:34 +0000
committertmator <tmator@gmail.com>2008-10-17 11:12:34 +0000
commit4477f77cf6c37e07433979331c22f362602ac76c (patch)
tree382360107cbdf7cc9cadf0a978aef4d602c3ffbc /Source/Core/Common/Src/Thread.cpp
parent9c5438cb0b36a3a5054fa9c376b6ded0e4c5f646 (diff)
add InterlockedExchangeAdd for olds gcc version
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@898 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/Thread.cpp')
-rw-r--r--Source/Core/Common/Src/Thread.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp
index 7254caf539..95b5d1ca65 100644
--- a/Source/Core/Common/Src/Thread.cpp
+++ b/Source/Core/Common/Src/Thread.cpp
@@ -350,8 +350,12 @@ int InterlockedExchangeAdd(int *Addend, int Increment)
#if defined(__GNUC__) && defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1 <= __GNUC_MINOR__))
return __sync_add_and_fetch(Addend, Increment);
#else
-#error Sorry - GCC versions that does not support __sync_add_and_fetch are not supported.
- // TODO support old gcc
+ register int result;
+ __asm__ __volatile__("lock; xadd %0,%1"
+ : "=r" (result), "=m" (*Addend)
+ : "0" (Increment), "m" (*Addend)
+ : "memory");
+ return result + Increment;
#endif
}