64 lines
2.1 KiB
Diff
64 lines
2.1 KiB
Diff
diff -up oiio-Release-1.1.3/src/include/thread.h.ppc oiio-Release-1.1.3/src/include/thread.h
|
|
--- oiio-Release-1.1.3/src/include/thread.h.ppc 2013-01-10 02:13:37.000000000 +0100
|
|
+++ oiio-Release-1.1.3/src/include/thread.h 2013-01-28 15:07:23.190624263 +0100
|
|
@@ -98,7 +98,7 @@
|
|
#endif
|
|
|
|
#if defined(__GNUC__) && (defined(_GLIBCXX_ATOMIC_BUILTINS) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 401))
|
|
-#if !defined(__FreeBSD__) || defined(__x86_64__)
|
|
+#if !defined(__FreeBSD__) && !defined(__PPC__) || defined(__x86_64__)
|
|
#define USE_GCC_ATOMICS
|
|
#endif
|
|
#endif
|
|
@@ -224,6 +224,11 @@ atomic_exchange_and_add (volatile int *a
|
|
#elif defined(_MSC_VER)
|
|
// 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
|
|
@@ -249,6 +254,11 @@ atomic_exchange_and_add (volatile long l
|
|
# 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
|
|
@@ -274,6 +284,8 @@ atomic_compare_and_exchange (volatile in
|
|
return OSAtomicCompareAndSwap32Barrier (compareval, newval, at);
|
|
#elif defined(_MSC_VER)
|
|
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
|
|
@@ -293,6 +305,8 @@ atomic_compare_and_exchange (volatile lo
|
|
return OSAtomicCompareAndSwap64Barrier (compareval, newval, at);
|
|
#elif defined(_MSC_VER)
|
|
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
|
|
@@ -324,7 +338,7 @@ pause (int delay)
|
|
{
|
|
#if USE_TBB
|
|
__TBB_Pause(delay);
|
|
-#elif defined(__GNUC__)
|
|
+#elif defined(__GNUC__) && !defined (__PPC__)
|
|
for (int i = 0; i < delay; ++i) {
|
|
__asm__ __volatile__("pause;");
|
|
}
|