Debian Codegraph @

compat/gcc/stdatomic.h

raw symbols SCIP
1 /*
2 * Copyright © 2018, VideoLAN and dav1d authors
3 * Copyright © 2020, VideoLAN and librist authors
4 * Copyright © 2019-2020 SipRadius LLC
5 * All rights reserved.
6 *
7 * SPDX-License-Identifier: BSD-2-Clause
8 */
9
10 #ifndef GCCVER_STDATOMIC_H_
11 #define GCCVER_STDATOMIC_H_
12
13 #include <stdbool.h>
14
15 #if !defined(__cplusplus)
16
17 typedef int atomic_int;
18 typedef unsigned int atomic_uint;
19 typedef unsigned long atomic_ulong;
20 typedef bool atomic_bool;
21
22 #define memory_order_relaxed __ATOMIC_RELAXED
23 #define memory_order_acquire __ATOMIC_ACQUIRE
24 #define memory_order_release __ATOMIC_RELEASE
25
26 #define atomic_init(p_a, v) __atomic_store_n(p_a, v, memory_order_relaxed)
27 #define atomic_store(p_a, v) __atomic_store_n(p_a, v, __ATOMIC_SEQ_CST)
28 #define atomic_load(p_a) __atomic_load_n(p_a, __ATOMIC_SEQ_CST)
29 #define atomic_load_explicit(p_a, mo) __atomic_load_n(p_a, mo)
30 #define atomic_store_explicit(p_a, v, mo) __atomic_store_n(p_a, v, mo)
31 #define atomic_fetch_add(p_a, inc) __atomic_fetch_add(p_a, inc, __ATOMIC_SEQ_CST)
32 #define atomic_fetch_add_explicit(p_a, inc, mo) __atomic_fetch_add(p_a, inc, mo)
33 #define atomic_fetch_sub(p_a, dec) __atomic_fetch_sub(p_a, dec, __ATOMIC_SEQ_CST)
34 #define atomic_fetch_sub_explicit(p_a, dec, mo) __atomic_fetch_sub(p_a, dec, mo)
35 #define atomic_compare_exchange_weak(object, expected, desired) __atomic_compare_exchange_n(object, expected, desired, true, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
36
37 #endif /* !defined(__cplusplus) */
38
39 #endif /* GCCVER_STDATOMIC_H_ */