core: bitop: add atomic compare-exchange
This commit is contained in:
@@ -7,4 +7,15 @@ BLUE_API int b_popcountl(long v);
|
||||
BLUE_API int b_ctzl(long v);
|
||||
BLUE_API int b_clzl(long v);
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define b_cmpxchg(v, expected_val, new_val) \
|
||||
__atomic_compare_exchange_n( \
|
||||
v, expected_val, new_val, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)
|
||||
#elif defined(_MSC_VER)
|
||||
/* TODO add MSVC support */
|
||||
#error MSVC intrinsics not yet supported
|
||||
#else
|
||||
#error Unsupported compiler
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user