Reverse CmpExch parameters to the sensible way around

This commit is contained in:
baldurk
2016-09-09 11:17:26 +02:00
parent aba0bbc1ea
commit c6fc2cc315
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ int32_t Dec32(volatile int32_t *i);
int64_t Inc64(volatile int64_t *i);
int64_t Dec64(volatile int64_t *i);
int64_t ExchAdd64(volatile int64_t *i, int64_t a);
int32_t CmpExch32(volatile int32_t *dest, int32_t exch, int32_t comp);
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal);
};
namespace Callstack
+2 -2
View File
@@ -60,9 +60,9 @@ int64_t ExchAdd64(volatile int64_t *i, int64_t a)
return __sync_add_and_fetch(i, int64_t(a));
}
int32_t CmpExch32(volatile int32_t *dest, int32_t exch, int32_t comp)
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
{
return __sync_val_compare_and_swap(dest, comp, exch);
return __sync_val_compare_and_swap(dest, oldVal, newVal);
}
};
+2 -2
View File
@@ -73,9 +73,9 @@ int64_t ExchAdd64(volatile int64_t *i, int64_t a)
return (int64_t)InterlockedExchangeAdd64((volatile LONG64 *)i, a);
}
int32_t CmpExch32(volatile int32_t *dest, int32_t exch, int32_t comp)
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
{
return (int32_t)InterlockedCompareExchange((volatile LONG *)dest, exch, comp);
return (int32_t)InterlockedCompareExchange((volatile LONG *)dest, newVal, oldVal);
}
};