mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Update c89atomic.
This commit is contained in:
+23
-4
@@ -462,6 +462,9 @@ dependencies. See below for platform-specific details.
|
|||||||
|
|
||||||
Note that GCC and Clang require `-msse2`, `-mavx2`, etc. for SIMD optimizations.
|
Note that GCC and Clang require `-msse2`, `-mavx2`, etc. for SIMD optimizations.
|
||||||
|
|
||||||
|
If you get errors about undefined references to `__sync_val_compare_and_swap_8`, `__atomic_load_8`,
|
||||||
|
etc. you need to link with `-latomic`.
|
||||||
|
|
||||||
|
|
||||||
2.1. Windows
|
2.1. Windows
|
||||||
------------
|
------------
|
||||||
@@ -14805,10 +14808,26 @@ typedef unsigned char c89atomic_bool;
|
|||||||
#define c89atomic_fetch_and_explicit_16(dst, src, order) __atomic_fetch_and(dst, src, order)
|
#define c89atomic_fetch_and_explicit_16(dst, src, order) __atomic_fetch_and(dst, src, order)
|
||||||
#define c89atomic_fetch_and_explicit_32(dst, src, order) __atomic_fetch_and(dst, src, order)
|
#define c89atomic_fetch_and_explicit_32(dst, src, order) __atomic_fetch_and(dst, src, order)
|
||||||
#define c89atomic_fetch_and_explicit_64(dst, src, order) __atomic_fetch_and(dst, src, order)
|
#define c89atomic_fetch_and_explicit_64(dst, src, order) __atomic_fetch_and(dst, src, order)
|
||||||
#define c89atomic_compare_and_swap_8 (dst, expected, desired) __sync_val_compare_and_swap(dst, expected, desired)
|
static C89ATOMIC_INLINE c89atomic_uint8 c89atomic_compare_and_swap_8(volatile c89atomic_uint8* dst, c89atomic_uint8 expected, c89atomic_uint8 desired)
|
||||||
#define c89atomic_compare_and_swap_16(dst, expected, desired) __sync_val_compare_and_swap(dst, expected, desired)
|
{
|
||||||
#define c89atomic_compare_and_swap_32(dst, expected, desired) __sync_val_compare_and_swap(dst, expected, desired)
|
__atomic_compare_exchange_n(dst, &expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||||
#define c89atomic_compare_and_swap_64(dst, expected, desired) __sync_val_compare_and_swap(dst, expected, desired)
|
return expected;
|
||||||
|
}
|
||||||
|
static C89ATOMIC_INLINE c89atomic_uint16 c89atomic_compare_and_swap_16(volatile c89atomic_uint16* dst, c89atomic_uint16 expected, c89atomic_uint16 desired)
|
||||||
|
{
|
||||||
|
__atomic_compare_exchange_n(dst, &expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||||
|
return expected;
|
||||||
|
}
|
||||||
|
static C89ATOMIC_INLINE c89atomic_uint32 c89atomic_compare_and_swap_32(volatile c89atomic_uint32* dst, c89atomic_uint32 expected, c89atomic_uint32 desired)
|
||||||
|
{
|
||||||
|
__atomic_compare_exchange_n(dst, &expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||||
|
return expected;
|
||||||
|
}
|
||||||
|
static C89ATOMIC_INLINE c89atomic_uint64 c89atomic_compare_and_swap_64(volatile c89atomic_uint64* dst, c89atomic_uint64 expected, c89atomic_uint64 desired)
|
||||||
|
{
|
||||||
|
__atomic_compare_exchange_n(dst, &expected, desired, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||||
|
return expected;
|
||||||
|
}
|
||||||
typedef c89atomic_uint8 c89atomic_flag;
|
typedef c89atomic_uint8 c89atomic_flag;
|
||||||
#define c89atomic_flag_test_and_set_explicit(dst, order) (c89atomic_bool)__atomic_test_and_set(dst, order)
|
#define c89atomic_flag_test_and_set_explicit(dst, order) (c89atomic_bool)__atomic_test_and_set(dst, order)
|
||||||
#define c89atomic_flag_clear_explicit(dst, order) __atomic_clear(dst, order)
|
#define c89atomic_flag_clear_explicit(dst, order) __atomic_clear(dst, order)
|
||||||
|
|||||||
Reference in New Issue
Block a user