Tweak PPC patch

This commit is contained in:
Richard M. Shaw 2013-10-01 15:14:19 -05:00
parent 5aad988794
commit 5907817269
1 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ diff -Naur oiio-Release-1.2.1.orig/src/include/thread.h oiio-Release-1.2.1/src/i
#elif defined(_MSC_VER)
// Windows
return _InterlockedExchangeAdd ((volatile LONG *)at, x);
+#elif defined (__powerpc__)
+#elif defined (__powerpc__) || defined (__PPC__)
+ long long r;
+ r = *at;
+ *at += x;
@ -28,7 +28,7 @@ diff -Naur oiio-Release-1.2.1.orig/src/include/thread.h oiio-Release-1.2.1/src/i
# else
return InterlockedExchangeAdd64 ((volatile LONGLONG *)at, x);
# endif
+#elif defined (__powerpc__)
+#elif defined (__powerpc__) || defined (__PPC__)
+ long long r;
+ r = *at;
+ *at += x;
@ -40,7 +40,7 @@ diff -Naur oiio-Release-1.2.1.orig/src/include/thread.h oiio-Release-1.2.1/src/i
return a->compare_and_swap (newval, compareval) == newval;
#elif defined(_MSC_VER)
return (_InterlockedCompareExchange ((volatile LONG *)at, newval, compareval) == compareval);
+#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined (__PPC__)
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
#else
# error No atomics on this platform.
@ -49,7 +49,7 @@ diff -Naur oiio-Release-1.2.1.orig/src/include/thread.h oiio-Release-1.2.1/src/i
return a->compare_and_swap (newval, compareval) == newval;
#elif defined(_MSC_VER)
return (_InterlockedCompareExchange64 ((volatile LONGLONG *)at, newval, compareval) == compareval);
+#elif defined(__PPC__)
+#elif defined(__powerpc__) || defined(__PPC__)
+ return ((*at == compareval) ? (*at = newval), 1 : 0);
#else
# error No atomics on this platform.