From f9b7c64c05d123a606e650d5fe590fc81a2c8e2b Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 15 Jun 2020 21:14:23 +1000 Subject: [PATCH] Add ma_compare_and_swap_16(). --- miniaudio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index e6abc60b..2c582700 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -7619,6 +7619,7 @@ ma_atomic_increment/decrement_*() takes a pointer to the variable being incremen #define ma_atomic_exchange_64(a, b) InterlockedExchange64((LONGLONG*)a, (LONGLONG)b) #define ma_atomic_increment_32(a) InterlockedIncrement((LONG*)a) #define ma_atomic_decrement_32(a) InterlockedDecrement((LONG*)a) +#define ma_compare_and_swap_16(d, e, c) _InterlockedCompareExchange16((short*)d, (short)e, (short)c) #define ma_compare_and_swap_32(d, e, c) _InterlockedCompareExchange((LONG*)d, (LONG)e, (LONG)c) #define ma_compare_and_swap_64(d, e, c) _InterlockedCompareExchange64((LONGLONG*)d, (LONGLONG)e, (LONGLONG)c) #define ma_compare_and_swap_ptr(d, e, c) _InterlockedCompareExchangePointer((void*volatile*)d, (void*)e, (void*)c) @@ -7636,6 +7637,7 @@ ma_atomic_increment/decrement_*() takes a pointer to the variable being incremen #endif #define ma_atomic_increment_32(a) __sync_add_and_fetch(a, 1) #define ma_atomic_decrement_32(a) __sync_sub_and_fetch(a, 1) +#define ma_compare_and_swap_16(d, e, c) __sync_val_compare_and_swap(d, c, e) #define ma_compare_and_swap_32(d, e, c) __sync_val_compare_and_swap(d, c, e) #define ma_compare_and_swap_64(d, e, c) __sync_val_compare_and_swap(d, c, e) #define ma_compare_and_swap_ptr(d, e, c) __sync_val_compare_and_swap(d, c, e)