1*b30d1939SAndy Fiddaman/* : : generated from contrib/ast/src/lib/libast/features/aso by iffe version 2012-07-17 : : */ 2*b30d1939SAndy Fiddaman#ifndef _def_aso_ast 3*b30d1939SAndy Fiddaman#define _def_aso_ast 1 4*b30d1939SAndy Fiddaman#define _sys_types 1 /* #include <sys/types.h> ok */ 5*b30d1939SAndy Fiddaman/* gcc 4.1+ 64 bit memory atomic operations model */ 6*b30d1939SAndy Fiddaman#define _aso_cas8(p,o,n) __sync_val_compare_and_swap(p,o,n) 7*b30d1939SAndy Fiddaman#define _aso_inc8(p) __sync_fetch_and_add(p,1) 8*b30d1939SAndy Fiddaman#define _aso_dec8(p) __sync_fetch_and_sub(p,1) 9*b30d1939SAndy Fiddaman#define _aso_cas16(p,o,n) __sync_val_compare_and_swap(p,o,n) 10*b30d1939SAndy Fiddaman#define _aso_inc16(p) __sync_fetch_and_add(p,1) 11*b30d1939SAndy Fiddaman#define _aso_dec16(p) __sync_fetch_and_sub(p,1) 12*b30d1939SAndy Fiddaman#define _aso_cas32(p,o,n) __sync_val_compare_and_swap(p,o,n) 13*b30d1939SAndy Fiddaman#define _aso_inc32(p) __sync_fetch_and_add(p,1) 14*b30d1939SAndy Fiddaman#define _aso_dec32(p) __sync_fetch_and_sub(p,1) 15*b30d1939SAndy Fiddaman#define _aso_cas64(p,o,n) __sync_val_compare_and_swap(p,o,n) 16*b30d1939SAndy Fiddaman#define _aso_inc64(p) __sync_fetch_and_add(p,1) 17*b30d1939SAndy Fiddaman#define _aso_dec64(p) __sync_fetch_and_sub(p,1) 18*b30d1939SAndy Fiddaman#if _ast_sizeof_pointer == 8 19*b30d1939SAndy Fiddaman#define _aso_casptr(p,o,n) ((void*)__sync_val_compare_and_swap(p,(uint64_t)o,(uint64_t)n)) 20*b30d1939SAndy Fiddaman#else 21*b30d1939SAndy Fiddaman#define _aso_casptr(p,o,n) ((void*)__sync_val_compare_and_swap(p,(uint32_t)o,(uint32_t)n)) 22*b30d1939SAndy Fiddaman#endif 23*b30d1939SAndy Fiddaman 24*b30d1939SAndy Fiddaman#endif 25