Add patch for ppc64 build.
This commit is contained in:
parent
2752d175a5
commit
7a6c661976
|
@ -0,0 +1,49 @@
|
|||
src/include/thread.h | 14 ++++++++++++++
|
||||
1 files changed, 14 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/src/include/thread.h b/src/include/thread.h
|
||||
index 3b3bd19..53773e8 100644
|
||||
--- a/src/include/thread.h
|
||||
+++ b/src/include/thread.h
|
||||
@@ -272,6 +272,11 @@ atomic_exchange_and_add (volatile int *at, int x)
|
||||
#elif defined(_WIN32)
|
||||
// Windows
|
||||
return _InterlockedExchangeAdd ((volatile LONG *)at, x);
|
||||
+#elif defined (__PPC__)
|
||||
+ long long r;
|
||||
+ r = *at;
|
||||
+ *at += x;
|
||||
+ return r;
|
||||
#else
|
||||
# error No atomics on this platform.
|
||||
#endif
|
||||
@@ -297,6 +302,11 @@ atomic_exchange_and_add (volatile long long *at, long long x)
|
||||
# else
|
||||
return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
|
||||
# endif
|
||||
+#elif defined (__PPC__)
|
||||
+ long long r;
|
||||
+ r = *at;
|
||||
+ *at += x;
|
||||
+ return r;
|
||||
#else
|
||||
# error No atomics on this platform.
|
||||
#endif
|
||||
@@ -322,6 +332,8 @@ atomic_compare_and_exchange (volatile int *at, int compareval, int newval)
|
||||
return OSAtomicCompareAndSwap32Barrier (compareval, newval, at);
|
||||
#elif defined(_WIN32)
|
||||
return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
|
||||
+#elif defined(__PPC__)
|
||||
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
|
||||
#else
|
||||
# error No atomics on this platform.
|
||||
#endif
|
||||
@@ -341,6 +353,8 @@ atomic_compare_and_exchange (volatile long long *at, long long compareval, long
|
||||
return OSAtomicCompareAndSwap64Barrier (compareval, newval, at);
|
||||
#elif defined(_WIN32)
|
||||
return (_InterlockedCompareExchange64 ((volatile LONGLONG *)at, newval, compareval) == compareval);
|
||||
+#elif defined(__PPC__)
|
||||
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
|
||||
#else
|
||||
# error No atomics on this platform.
|
||||
#endif
|
Loading…
Reference in New Issue