diff --git a/core/include/blue/core/bitop.h b/core/include/blue/core/bitop.h index f6ddf59..079c4a3 100644 --- a/core/include/blue/core/bitop.h +++ b/core/include/blue/core/bitop.h @@ -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); -#endif \ No newline at end of file +#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