|
|
@ -53,7 +53,7 @@ static inline size_t atomic_add_return(size_t* x,size_t val) {
|
|
|
|
/* *x += val; */
|
|
|
|
/* *x += val; */
|
|
|
|
static inline void atomic_add(size_t* x,size_t val) {
|
|
|
|
static inline void atomic_add(size_t* x,size_t val) {
|
|
|
|
#ifdef USE_BUILTINS
|
|
|
|
#ifdef USE_BUILTINS
|
|
|
|
return __sync_add_and_fetch(x,val);
|
|
|
|
__sync_add_and_fetch(x,val);
|
|
|
|
#elif defined(__i386__)
|
|
|
|
#elif defined(__i386__)
|
|
|
|
asm volatile ("lock; addl %1, %0" : "+m" (*x) : "ir" (val) );
|
|
|
|
asm volatile ("lock; addl %1, %0" : "+m" (*x) : "ir" (val) );
|
|
|
|
#elif defined(__x86_64__)
|
|
|
|
#elif defined(__x86_64__)
|
|
|
|