From 2d633652f81be04d22a68f19e8430a64af3e045b Mon Sep 17 00:00:00 2001 From: Henrik Gramner Date: Fri, 3 Sep 2021 18:51:37 +0200 Subject: msvc: Add compat macros for additional atomic operations --- include/compat/msvc/stdatomic.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/compat/msvc/stdatomic.h b/include/compat/msvc/stdatomic.h index 979ee2b..b739d6a 100644 --- a/include/compat/msvc/stdatomic.h +++ b/include/compat/msvc/stdatomic.h @@ -52,6 +52,7 @@ typedef enum { #define atomic_init(p_a, v) do { *(p_a) = (v); } while(0) #define atomic_store(p_a, v) InterlockedExchange((LONG*)p_a, v) #define atomic_load(p_a) InterlockedCompareExchange((LONG*)p_a, 0, 0) +#define atomic_exchange(p_a, v) InterlockedExchange(p_a, v) #define atomic_load_explicit(p_a, mo) atomic_load(p_a) /* @@ -60,6 +61,7 @@ typedef enum { */ #define atomic_fetch_add(p_a, inc) InterlockedExchangeAdd(p_a, inc) #define atomic_fetch_sub(p_a, dec) InterlockedExchangeAdd(p_a, -(dec)) +#define atomic_fetch_or(p_a, v) InterlockedOr(p_a, v) #endif /* ! stdatomic.h */ -- cgit v1.2.3