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