55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
diff -Naur OpenImageIO-oiio-2939154.orig/src/include/thread.h OpenImageIO-oiio-2939154/src/include/thread.h
|
|
--- OpenImageIO-oiio-2939154.orig/src/include/thread.h 2012-06-04 12:30:16.000000000 -0500
|
|
+++ OpenImageIO-oiio-2939154/src/include/thread.h 2012-06-13 15:14:36.648990016 -0500
|
|
@@ -103,7 +103,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
|
|
@@ -272,6 +272,11 @@
|
|
#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
|
|
@@ -297,6 +302,11 @@
|
|
# 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
|
|
@@ -322,6 +332,8 @@
|
|
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
|
|
@@ -341,6 +353,8 @@
|
|
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
|