21 #ifndef AVUTIL_ATOMIC_GCC_H
22 #define AVUTIL_ATOMIC_GCC_H
28 #define avpriv_atomic_int_get atomic_int_get_gcc
31 #if HAVE_ATOMIC_COMPARE_EXCHANGE
32 return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
39 #define avpriv_atomic_int_set atomic_int_set_gcc
42 #if HAVE_ATOMIC_COMPARE_EXCHANGE
43 __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
50 #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_gcc
53 #if HAVE_ATOMIC_COMPARE_EXCHANGE
54 return __atomic_add_fetch(ptr, inc, __ATOMIC_SEQ_CST);
56 return __sync_add_and_fetch(ptr, inc);
60 #define avpriv_atomic_ptr_cas atomic_ptr_cas_gcc
62 void *oldval,
void *newval)
64 #if HAVE_SYNC_VAL_COMPARE_AND_SWAP
65 #ifdef __ARMCC_VERSION
67 volatile uintptr_t *tmp = (
volatile uintptr_t*)ptr;
68 return (
void*)__sync_val_compare_and_swap(tmp, oldval, newval);
70 return __sync_val_compare_and_swap(ptr, oldval, newval);
73 __atomic_compare_exchange_n(ptr, &oldval, newval, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
const char const char void * val
static void atomic_int_set_gcc(volatile int *ptr, int val)
static int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc)
static int atomic_int_get_gcc(volatile int *ptr)
static void * atomic_ptr_cas_gcc(void *volatile *ptr, void *oldval, void *newval)