OpenImageIO/oiio-ppc.patch
2013-08-28 15:03:38 -05:00

57 lines
1.7 KiB
Diff

diff -Naur oiio-Release-1.2.1.orig/src/include/thread.h oiio-Release-1.2.1/src/include/thread.h
--- oiio-Release-1.2.1.orig/src/include/thread.h 2013-08-06 00:10:31.000000000 -0500
+++ oiio-Release-1.2.1/src/include/thread.h 2013-08-28 14:35:21.873905568 -0500
@@ -112,8 +112,10 @@
#endif
#if defined(__GNUC__) && (defined(_GLIBCXX_ATOMIC_BUILTINS) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 401))
+#if !defined(__FreeBSD__) && !defined(__powerpc__) || defined(__x86_64__)
#define USE_GCC_ATOMICS
#endif
+#endif
OIIO_NAMESPACE_ENTER
{
@@ -227,6 +229,11 @@
#elif defined(_MSC_VER)
// Windows
return _InterlockedExchangeAdd ((volatile LONG *)at, x);
+#elif defined (__powerpc__)
+ long long r;
+ r = *at;
+ *at += x;
+ return r;
#else
# error No atomics on this platform.
#endif
@@ -249,6 +256,11 @@
# else
return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
# endif
+#elif defined (__powerpc__)
+ long long r;
+ r = *at;
+ *at += x;
+ return r;
#else
# error No atomics on this platform.
#endif
@@ -272,6 +284,8 @@
return a->compare_and_swap (newval, compareval) == newval;
#elif defined(_MSC_VER)
return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
+#elif defined(__powerpc__)
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
#else
# error No atomics on this platform.
#endif
@@ -289,6 +303,8 @@
return a->compare_and_swap (newval, compareval) == newval;
#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