OpenImageIO/oiio-ppc.patch

57 lines
1.7 KiB
Diff
Raw Normal View History

2013-08-28 20:03:38 +00:00
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))
2013-05-27 15:21:41 +00:00
+#if !defined(__FreeBSD__) && !defined(__powerpc__) || defined(__x86_64__)
#define USE_GCC_ATOMICS
#endif
2013-08-28 20:03:38 +00:00
+#endif
OIIO_NAMESPACE_ENTER
{
@@ -227,6 +229,11 @@
2013-01-28 13:34:02 +00:00
#elif defined(_MSC_VER)
2012-06-12 19:03:59 +00:00
// Windows
return _InterlockedExchangeAdd ((volatile LONG *)at, x);
2013-05-27 15:21:41 +00:00
+#elif defined (__powerpc__)
2013-01-28 13:34:02 +00:00
+ long long r;
+ r = *at;
+ *at += x;
+ return r;
2012-06-12 19:03:59 +00:00
#else
# error No atomics on this platform.
#endif
2013-08-28 20:03:38 +00:00
@@ -249,6 +256,11 @@
2012-06-12 19:03:59 +00:00
# else
return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
# endif
2013-05-27 15:21:41 +00:00
+#elif defined (__powerpc__)
2012-06-12 19:03:59 +00:00
+ long long r;
+ r = *at;
+ *at += x;
+ return r;
#else
# error No atomics on this platform.
#endif
2013-08-28 20:03:38 +00:00
@@ -272,6 +284,8 @@
2013-05-27 15:21:41 +00:00
return a->compare_and_swap (newval, compareval) == newval;
2013-01-28 13:34:02 +00:00
#elif defined(_MSC_VER)
2012-06-12 19:03:59 +00:00
return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
2013-05-27 15:21:41 +00:00
+#elif defined(__powerpc__)
2012-06-12 19:03:59 +00:00
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
#else
# error No atomics on this platform.
#endif
2013-08-28 20:03:38 +00:00
@@ -289,6 +303,8 @@
2013-05-27 15:21:41 +00:00
return a->compare_and_swap (newval, compareval) == newval;
2013-01-28 13:34:02 +00:00
#elif defined(_MSC_VER)
2012-06-12 19:03:59 +00:00
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