diff options
Diffstat (limited to 'chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h')
-rw-r--r-- | chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h b/chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h index 4154da0a453..618f0ee87db 100644 --- a/chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h +++ b/chromium/third_party/dav1d/libdav1d/include/compat/msvc/stdatomic.h @@ -55,6 +55,15 @@ typedef enum { #define atomic_exchange(p_a, v) InterlockedExchange(p_a, v) #define atomic_load_explicit(p_a, mo) atomic_load(p_a) +static inline int atomic_compare_exchange_strong_int(LONG *obj, LONG *expected, + LONG desired) +{ + LONG orig = *expected; + *expected = InterlockedCompareExchange(obj, desired, orig); + return *expected == orig; +} +#define atomic_compare_exchange_strong(p_a, expected, desired) atomic_compare_exchange_strong_int((LONG *)p_a, (LONG *)expected, (LONG)desired) + /* * TODO use a special call to increment/decrement * using InterlockedIncrement/InterlockedDecrement @@ -62,6 +71,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) +#define atomic_fetch_add_explicit(p_a, inc, mo) atomic_fetch_add(p_a, inc) #endif /* ! stdatomic.h */ |