7a6c661
 src/include/thread.h |   14 ++++++++++++++
7a6c661
 1 files changed, 14 insertions(+), 0 deletions(-)
7a6c661
7a6c661
diff --git a/src/include/thread.h b/src/include/thread.h
7a6c661
index 3b3bd19..53773e8 100644
7a6c661
--- a/src/include/thread.h
7a6c661
+++ b/src/include/thread.h
7a6c661
@@ -272,6 +272,11 @@ atomic_exchange_and_add (volatile int *at, int x)
7a6c661
 #elif defined(_WIN32)
7a6c661
     // Windows
7a6c661
     return _InterlockedExchangeAdd ((volatile LONG *)at, x);
7a6c661
+#elif defined (__PPC__)
7a6c661
+   long long r;
7a6c661
+   r = *at;
7a6c661
+   *at += x;
7a6c661
+   return r;
7a6c661
 #else
7a6c661
 #   error No atomics on this platform.
7a6c661
 #endif
7a6c661
@@ -297,6 +302,11 @@ atomic_exchange_and_add (volatile long long *at, long long x)
7a6c661
 #  else
7a6c661
     return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
7a6c661
 #  endif
7a6c661
+#elif defined (__PPC__)
7a6c661
+   long long r;
7a6c661
+   r = *at;
7a6c661
+   *at += x;
7a6c661
+   return r;
7a6c661
 #else
7a6c661
 #   error No atomics on this platform.
7a6c661
 #endif
7a6c661
@@ -322,6 +332,8 @@ atomic_compare_and_exchange (volatile int *at, int compareval, int newval)
7a6c661
     return OSAtomicCompareAndSwap32Barrier (compareval, newval, at);
7a6c661
 #elif defined(_WIN32)
7a6c661
     return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
7a6c661
+#elif defined(__PPC__)
7a6c661
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
7a6c661
 #else
7a6c661
 #   error No atomics on this platform.
7a6c661
 #endif
7a6c661
@@ -341,6 +353,8 @@ atomic_compare_and_exchange (volatile long long *at, long long compareval, long
7a6c661
     return OSAtomicCompareAndSwap64Barrier (compareval, newval, at);
7a6c661
 #elif defined(_WIN32)
7a6c661
     return (_InterlockedCompareExchange64 ((volatile LONGLONG *)at, newval, compareval) == compareval);
7a6c661
+#elif defined(__PPC__)
7a6c661
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
7a6c661
 #else
7a6c661
 #   error No atomics on this platform.
7a6c661
 #endif