changes
[IRC.git] / Robust / src / Runtime / mlp_lock.h
index 3eb341ea27fafa68e0b2dc1b94ccf81d193ce2dc..c5f6ac0b297c67a8fe759009b33fd192d5c4fe1a 100644 (file)
@@ -43,28 +43,30 @@ static inline int atomic_sub_and_test(int i, volatile int *v) {
   return c;
 }
 
-#ifdef BIT64
-static inline INTPTR LOCKXCHG(volatile INTPTR * ptr, INTPTR val){
-  INTPTR retval;
+static inline int LOCKXCHG32(volatile int* ptr, int val){
+  int retval;
   //note: xchgl always implies lock 
-  __asm__ __volatile__("xchgq %0,%1"
+  __asm__ __volatile__("xchgl %0,%1"
                       : "=r"(retval)
                       : "m"(*ptr), "0"(val)
                       : "memory");
   return retval;
  
 }
-#else
-static inline int LOCKXCHG(volatile int* ptr, int val){
-  int retval;
+
+#ifdef BIT64
+static inline INTPTR LOCKXCHG(volatile INTPTR * ptr, INTPTR val){
+  INTPTR retval;
   //note: xchgl always implies lock 
-  __asm__ __volatile__("xchgl %0,%1"
+  __asm__ __volatile__("xchgq %0,%1"
                       : "=r"(retval)
                       : "m"(*ptr), "0"(val)
                       : "memory");
   return retval;
  
 }
+#else
+#define LOCKXCHG LOCKXCHG32
 #endif
 
 /*