Blob Blame History Raw
diff -up jack-1.9.5/linux/JackAtomic_os.h.atomic jack-1.9.5/linux/JackAtomic_os.h
--- jack-1.9.5/linux/JackAtomic_os.h.atomic	2010-08-28 15:23:58.000000000 +0200
+++ jack-1.9.5/linux/JackAtomic_os.h	2010-09-01 09:29:03.000000000 +0200
@@ -22,23 +22,23 @@ Foundation, Inc., 59 Temple Place - Suit
 
 #include "JackTypes.h"
 
-#ifdef __PPC__
+#if defined(__PPC__)
 
 static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
 {
     register int result;
     register UInt32 tmp;
     asm volatile (
-        "# CAS					\n"
-        "	lwarx	%4, 0, %1	\n"         // creates a reservation on addr
-        "	cmpw	%4, %2		\n"        //  test value at addr
-        "	bne-	1f          \n"
-        "	sync            	\n"         //  synchronize instructions
-        "	stwcx.	%3, 0, %1	\n"         //  if the reservation is not altered
+        "# CAS                                  \n"
+        "       lwarx   %4, 0, %1       \n"         // creates a reservation on addr
+        "       cmpw    %4, %2          \n"        //  test value at addr
+        "       bne-    1f          \n"
+        "       sync                    \n"         //  synchronize instructions
+        "       stwcx.  %3, 0, %1       \n"         //  if the reservation is not altered
         //  stores the new value at addr
-        "	bne-	1f          \n"
+        "       bne-    1f          \n"
         "   li      %0, 1       \n"
-        "	b		2f          \n"
+        "       b               2f          \n"
         "1:                     \n"
         "   li      %0, 0       \n"
         "2:                     \n"
@@ -48,9 +48,7 @@ static inline int CAS(register UInt32 va
     return result;
 }
 
-#endif
-
-#if defined(__i386__) || defined(__x86_64__)
+#elif defined(__i386__) || defined(__x86_64__)
 
 #define LOCK "lock ; "
 
@@ -67,6 +65,13 @@ static inline char CAS(volatile UInt32 v
     return ret;
 }
 
+#else
+
+static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
+{
+    return __sync_val_compare_and_swap((UInt32 *)addr, value, newvalue);
+}
+
 #endif
 
 #endif