Linux tweaks.

This commit is contained in:
Ben Vanik
2015-08-18 14:18:00 -07:00
parent 19299fad4b
commit 8b0d4fb51c
37 changed files with 200 additions and 111 deletions

View File

@@ -102,17 +102,17 @@ inline int32_t atomic_dec(volatile int32_t* value) {
}
inline int32_t atomic_exchange(int32_t new_value, volatile int32_t* value) {
return __sync_val_compare_and_swap(*value, value, new_value);
return __sync_val_compare_and_swap(value, *value, new_value);
}
inline int64_t atomic_exchange(int64_t new_value, volatile int64_t* value) {
return __sync_val_compare_and_swap(*value, value, new_value);
return __sync_val_compare_and_swap(value, *value, new_value);
}
inline int32_t atomic_exchange_add(int32_t amount, volatile int32_t* value) {
return __sync_fetch_and_add(amount, value);
return __sync_fetch_and_add(value, amount);
}
inline int64_t atomic_exchange_add(int64_t amount, volatile int64_t* value) {
return __sync_fetch_and_add(amount, value);
return __sync_fetch_and_add(value, amount);
}
inline bool atomic_cas(int32_t old_value, int32_t new_value,