7709c72
diff -up oiio-Release-1.1.3/src/include/thread.h.ppc oiio-Release-1.1.3/src/include/thread.h
7709c72
--- oiio-Release-1.1.3/src/include/thread.h.ppc	2013-01-10 02:13:37.000000000 +0100
d3a5a33
+++ oiio-Release-1.1.3/src/include/thread.h	2013-01-28 15:07:23.190624263 +0100
7709c72
@@ -98,7 +98,7 @@
f84394c
 #endif
f84394c
 
f84394c
 #if defined(__GNUC__) && (defined(_GLIBCXX_ATOMIC_BUILTINS) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 401))
f84394c
-#if !defined(__FreeBSD__) || defined(__x86_64__)
f84394c
+#if !defined(__FreeBSD__) && !defined(__PPC__) || defined(__x86_64__)
f84394c
 #define USE_GCC_ATOMICS
f84394c
 #endif
f84394c
 #endif
7709c72
@@ -224,6 +224,11 @@ atomic_exchange_and_add (volatile int *a
7709c72
 #elif defined(_MSC_VER)
011445b
     // Windows
011445b
     return _InterlockedExchangeAdd ((volatile LONG *)at, x);
011445b
+#elif defined (__PPC__)
7709c72
+    long long r;
7709c72
+    r = *at;
7709c72
+    *at += x;
7709c72
+    return r;
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
7709c72
@@ -249,6 +254,11 @@ atomic_exchange_and_add (volatile long l
011445b
 #  else
011445b
     return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
011445b
 #  endif
011445b
+#elif defined (__PPC__)
011445b
+   long long r;
011445b
+   r = *at;
011445b
+   *at += x;
011445b
+   return r;
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
7709c72
@@ -274,6 +284,8 @@ atomic_compare_and_exchange (volatile in
011445b
     return OSAtomicCompareAndSwap32Barrier (compareval, newval, at);
7709c72
 #elif defined(_MSC_VER)
011445b
     return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
011445b
+#elif defined(__PPC__)
011445b
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
7709c72
@@ -293,6 +305,8 @@ atomic_compare_and_exchange (volatile lo
011445b
     return OSAtomicCompareAndSwap64Barrier (compareval, newval, at);
7709c72
 #elif defined(_MSC_VER)
011445b
     return (_InterlockedCompareExchange64 ((volatile LONGLONG *)at, newval, compareval) == compareval);
011445b
+#elif defined(__PPC__)
011445b
+    return ((*at == compareval) ? (*at = newval), 1 : 0);
011445b
 #else
011445b
 #   error No atomics on this platform.
011445b
 #endif
d3a5a33
@@ -324,7 +338,7 @@ pause (int delay)
d3a5a33
 {
d3a5a33
 #if USE_TBB
d3a5a33
     __TBB_Pause(delay);
d3a5a33
-#elif defined(__GNUC__)
d3a5a33
+#elif defined(__GNUC__) && !defined (__PPC__)
d3a5a33
     for (int i = 0; i < delay; ++i) {
d3a5a33
         __asm__ __volatile__("pause;");
d3a5a33
     }