OpenImageIO/OpenImageIO-ppc.patch

46 lines
1.6 KiB
Diff
Raw Normal View History

2012-06-12 19:03:59 +00:00
diff -up OpenImageIO-oiio-1fa4a20/src/include/thread.h.ppckh OpenImageIO-oiio-1fa4a20/src/include/thread.h
--- OpenImageIO-oiio-1fa4a20/src/include/thread.h.ppckh 2012-04-25 15:29:32.530321567 +0200
+++ OpenImageIO-oiio-1fa4a20/src/include/thread.h 2012-04-25 15:29:42.490320642 +0200
@@ -267,6 +267,11 @@ atomic_exchange_and_add (volatile int *a
#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
@@ -292,6 +297,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
@@ -317,6 +327,8 @@ atomic_compare_and_exchange (volatile in
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
@@ -336,6 +348,8 @@ atomic_compare_and_exchange (volatile lo
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