add InterlockedExchangeAdd for olds gcc version
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@898 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9c5438cb0b
commit
4477f77cf6
|
@ -350,8 +350,12 @@ int InterlockedExchangeAdd(int *Addend, int Increment)
|
||||||
#if defined(__GNUC__) && defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1 <= __GNUC_MINOR__))
|
#if defined(__GNUC__) && defined (__GNUC_MINOR__) && ((4 < __GNUC__) || (4 == __GNUC__ && 1 <= __GNUC_MINOR__))
|
||||||
return __sync_add_and_fetch(Addend, Increment);
|
return __sync_add_and_fetch(Addend, Increment);
|
||||||
#else
|
#else
|
||||||
#error Sorry - GCC versions that does not support __sync_add_and_fetch are not supported.
|
register int result;
|
||||||
// TODO support old gcc
|
__asm__ __volatile__("lock; xadd %0,%1"
|
||||||
|
: "=r" (result), "=m" (*Addend)
|
||||||
|
: "0" (Increment), "m" (*Addend)
|
||||||
|
: "memory");
|
||||||
|
return result + Increment;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue