31#define as_load_rlx(_target) __atomic_load_n(_target, __ATOMIC_RELAXED)
34#define as_load_acq(_target) __atomic_load_n(_target, __ATOMIC_ACQUIRE)
37#define as_load_seq(_target) __atomic_load_n(_target, __ATOMIC_SEQ_CST)
103static inline uint64_t
115static inline uint32_t
127static inline uint16_t
156#define as_store_rlx(_target, _value) __atomic_store_n(_target, _value, __ATOMIC_RELAXED)
159#define as_store_rls(_target, _value) __atomic_store_n(_target, _value, __ATOMIC_RELEASE)
162#define as_store_seq(_target, _value) __atomic_store_n(_target, _value, __ATOMIC_SEQ_CST)
281#define as_faa_rlx(_target, _value) __atomic_fetch_add(_target, _value, __ATOMIC_RELAXED)
284#define as_faa_acq(_target, _value) __atomic_fetch_add(_target, _value, __ATOMIC_ACQUIRE)
287#define as_faa_rls(_target, _value) __atomic_fetch_add(_target, _value, __ATOMIC_RELEASE)
290#define as_faa_seq(_target, _value) __atomic_fetch_add(_target, _value, __ATOMIC_SEQ_CST)
294static inline uint64_t
306static inline uint32_t
318static inline uint16_t
335#define as_aaf_rlx(_target, _value) __atomic_add_fetch(_target, _value, __ATOMIC_RELAXED)
338#define as_aaf_acq(_target, _value) __atomic_add_fetch(_target, _value, __ATOMIC_ACQUIRE)
341#define as_aaf_rls(_target, _value) __atomic_add_fetch(_target, _value, __ATOMIC_RELEASE)
344#define as_aaf_seq(_target, _value) __atomic_add_fetch(_target, _value, __ATOMIC_SEQ_CST)
348static inline uint64_t
360static inline uint32_t
372static inline uint16_t
386static inline uint64_t
398static inline uint32_t
410static inline uint16_t
629#define as_fas_rlx(_target, _value) __atomic_exchange_n(_target, _value, __ATOMIC_RELAXED)
632#define as_fas_acq(_target, _value) __atomic_exchange_n(_target, _value, __ATOMIC_ACQUIRE)
635#define as_fas_rls(_target, _value) __atomic_exchange_n(_target, _value, __ATOMIC_RELEASE)
638#define as_fas_seq(_target, _value) __atomic_exchange_n(_target, _value, __ATOMIC_SEQ_CST)
642static inline uint64_t
654static inline uint32_t
666static inline uint16_t
684#define as_cas_rlx(_target, _old_value, _new_value) __atomic_compare_exchange_n(_target, _old_value, _new_value, false, __ATOMIC_RELAXED, __ATOMIC_RELAXED)
688#define as_cas_acq(_target, _old_value, _new_value) __atomic_compare_exchange_n(_target, _old_value, _new_value, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)
692#define as_cas_rls(_target, _old_value, _new_value) __atomic_compare_exchange_n(_target, _old_value, _new_value, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED)
696#define as_cas_seq(_target, _old_value, _new_value) __atomic_compare_exchange_n(_target, _old_value, _new_value, false, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED)
703 return as_cas_rlx(target, &old_value, new_value);
709 return as_cas_rlx(target, &old_value, new_value);
715 return as_cas_rlx(target, &old_value, new_value);
721 return as_cas_rlx(target, &old_value, new_value);
727 return as_cas_rlx(target, &old_value, new_value);
733 return as_cas_rlx(target, &old_value, new_value);
739 return as_cas_rlx(target, &old_value, new_value);
745 return as_cas_rlx(target, &old_value, new_value);
753#define as_fence_acq() __atomic_thread_fence(__ATOMIC_ACQUIRE)
756#define as_fence_rls() __atomic_thread_fence(__ATOMIC_RELEASE)
760#define as_fence_rlx() __atomic_thread_fence(__ATOMIC_RELAXED)
763#define as_fence_seq() __atomic_thread_fence(__ATOMIC_SEQ_CST)
769typedef struct as_spinlock_s {
773#define AS_SPINLOCK_INIT { 0 }
774#define as_spinlock_init(_s) (_s)->u32 = 0
775#define as_spinlock_destroy(_s) ((void)_s)
782 while (s->
u32 == 1) {
798typedef struct as_swlock_s {
802#define AS_SWLOCK_INIT { 0 }
803#define as_swlock_init(_s) (_s)->u32 = 0
804#define as_swlock_destroy(_s) ((void)_s)
806#define AS_SWLOCK_WRITER_BIT ((uint32_t)1 << 31)
807#define AS_SWLOCK_LATCH_BIT ((uint32_t)1 << 30)
808#define AS_SWLOCK_WRITER_MASK (AS_SWLOCK_LATCH_BIT | AS_SWLOCK_WRITER_BIT)
809#define AS_SWLOCK_READER_MASK (UINT32_MAX ^ AS_SWLOCK_WRITER_MASK)
#define as_fas_rlx(_target, _value)
#define AS_SWLOCK_READER_MASK
#define as_fas_acq(_target, _value)
static void as_add_int16(int16_t *target, int16_t value)
static void as_spinlock_unlock(as_spinlock *s)
#define as_faa_rls(_target, _value)
#define as_load_rlx(_target)
#define as_store_rls(_target, _value)
#define AS_SWLOCK_WRITER_BIT
static uint16_t as_aaf_uint16(uint16_t *target, int16_t value)
#define as_faa_rlx(_target, _value)
static bool as_setmax_uint64(uint64_t *target, uint64_t x)
static uint16_t as_faa_uint16(uint16_t *target, int16_t value)
static int16_t as_faa_int16(int16_t *target, int16_t value)
#define as_store_rlx(_target, _value)
static bool as_setmax_uint32(uint32_t *target, uint32_t x)
static void as_swlock_write_lock(as_swlock *rw)
static void as_swlock_read_unlock(as_swlock *rw)
static uint16_t as_aaf_uint16_rls(uint16_t *target, int16_t value)
static void as_spinlock_lock(as_spinlock *s)
static void as_swlock_write_unlock(as_swlock *rw)
static void as_swlock_read_lock(as_swlock *rw)
static void as_add_uint16(uint16_t *target, int16_t value)
#define as_aaf_rls(_target, _value)
#define as_aaf_rlx(_target, _value)
#define as_cas_rlx(_target, _old_value, _new_value)
static int16_t as_aaf_int16(int16_t *target, int16_t value)
static int16_t as_aaf_int16_rls(int16_t *target, int16_t value)
#define AS_SWLOCK_WRITER_MASK
#define as_load_acq(_target)
#define as_load_int32_acq(_target)
#define as_cas_uint16(_target, _old_value, _new_value)
#define as_decr_uint16(_target)
#define as_decr_int32(_target)
#define as_fas_int32(_target, _value)
#define as_load_uint64_acq(_target)
#define as_incr_int32(_target)
#define as_load_ptr_acq(_target)
#define as_load_ptr(_target)
#define as_decr_int64_rls(_target)
#define as_load_int8(_target)
#define as_aaf_int32(_target, _value)
#define as_decr_uint64_rls(_target)
#define as_add_int64(_target, _value)
#define as_load_int8_acq(_target)
#define as_cas_int32(_target, _old_value, _new_value)
#define as_decr_int64(_target)
#define as_incr_uint64_rls(_target)
#define as_fas_uint16(_target, _value)
#define as_store_int64_rls(_target, _value)
#define as_decr_int32_rls(_target)
#define as_incr_uint16(_target)
#define as_fas_int64(_target, _value)
#define as_incr_uint64(_target)
#define as_incr_int32_rls(_target)
#define as_load_int64(_target)
#define as_store_int32_rls(_target, _value)
#define as_faa_uint32(_target, _value)
#define as_load_uint8(_target)
#define as_load_int16_acq(_target)
#define as_faa_uint64(_target, _value)
#define as_incr_uint32(_target)
#define as_load_uint32_acq(_target)
#define as_cas_uint64(_target, _old_value, _new_value)
#define as_decr_uint64(_target)
#define as_aaf_uint64(_target, _value)
#define as_aaf_uint32(_target, _value)
#define as_store_int8_rls(_target, _value)
#define as_decr_uint16_rls(_target)
#define as_incr_int16(_target)
#define as_aaf_int64(_target, _value)
#define as_store_ptr_rls(_target, _value)
#define as_store_uint8(_target, _value)
#define as_decr_uint32_rls(_target)
#define as_incr_int16_rls(_target)
#define as_store_int16_rls(_target, _value)
#define as_cas_uint32(_target, _old_value, _new_value)
#define as_store_uint16_rls(_target, _value)
#define as_incr_int64_rls(_target)
#define as_add_int32(_target, _value)
#define as_store_ptr(_target, _value)
#define as_add_uint32(_target, _value)
#define as_load_int16(_target)
#define as_decr_int16(_target)
#define as_fas_uint64(_target, _value)
#define as_load_uint16(_target)
#define as_store_uint16(_target, _value)
#define as_faa_int64(_target, _value)
#define as_store_uint8_rls(_target, _value)
#define as_cas_int64(_target, _old_value, _new_value)
#define as_fas_int16(_target, _value)
#define as_decr_int16_rls(_target)
#define as_add_uint64(_target, _value)
#define as_load_uint8_acq(_target)
#define as_cas_int16(_target, _old_value, _new_value)
#define as_incr_uint32_rls(_target)
#define as_fas_uint32(_target, _value)
#define as_incr_uint16_rls(_target)
#define as_store_int8(_target, _value)
#define as_load_uint64(_target)
#define as_store_int16(_target, _value)
#define as_store_uint64_rls(_target, _value)
#define as_aaf_int64_rls(_target, _value)
#define as_aaf_uint64_rls(_target, _value)
#define as_load_int64_acq(_target)
#define as_store_int64(_target, _value)
#define as_decr_uint32(_target)
#define as_cas_int8(_target, _old_value, _new_value)
#define as_aaf_uint32_rls(_target, _value)
#define as_store_uint32_rls(_target, _value)
#define as_incr_int64(_target)
#define as_load_int32(_target)
#define as_store_uint64(_target, _value)
#define as_load_uint32(_target)
#define as_aaf_int32_rls(_target, _value)
#define as_store_uint32(_target, _value)
#define as_store_int32(_target, _value)
#define as_load_uint16_acq(_target)
#define as_faa_int32(_target, _value)
#define as_cas_uint8(_target, _old_value, _new_value)