@@ -27,11 +27,11 @@ #ifdef OF_HAVE_OSATOMIC # include #endif static OF_INLINE int -of_atomic_add_int(volatile int *p, int i) +of_atomic_int_add(volatile int *p, int i) { #if !defined(OF_HAVE_THREADS) return (*p += i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) @@ -59,16 +59,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(i, p); #else -# error of_atomic_add_int not implemented! +# error of_atomic_int_add not implemented! #endif } static OF_INLINE int32_t -of_atomic_add_32(volatile int32_t *p, int32_t i) +of_atomic_int32_add(volatile int32_t *p, int32_t i) { #if !defined(OF_HAVE_THREADS) return (*p += i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( @@ -83,16 +83,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(i, p); #else -# error of_atomic_add_32 not implemented! +# error of_atomic_int32_add not implemented! #endif } static OF_INLINE void* -of_atomic_add_ptr(void* volatile *p, intptr_t i) +of_atomic_ptr_add(void* volatile *p, intptr_t i) { #if !defined(OF_HAVE_THREADS) return (*(char* volatile*)p += i); #elif defined(OF_X86_64_ASM) __asm__ __volatile__ ( @@ -121,16 +121,16 @@ return (void*)OSAtomicAdd64Barrier(i, (int64_t*)p); # else return (void*)OSAtomicAdd32Barrier(i, (int32_t*)p); # endif #else -# error of_atomic_add_ptr not implemented! +# error of_atomic_ptr_add not implemented! #endif } static OF_INLINE int -of_atomic_sub_int(volatile int *p, int i) +of_atomic_int_sub(volatile int *p, int i) { #if !defined(OF_HAVE_THREADS) return (*p -= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) @@ -160,16 +160,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(-i, p); #else -# error of_atomic_sub_int not implemented! +# error of_atomic_int_sub not implemented! #endif } static OF_INLINE int32_t -of_atomic_sub_32(volatile int32_t *p, int32_t i) +of_atomic_int32_sub(volatile int32_t *p, int32_t i) { #if !defined(OF_HAVE_THREADS) return (*p -= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( @@ -185,16 +185,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAdd32Barrier(-i, p); #else -# error of_atomic_sub_32 not implemented! +# error of_atomic_int32_sub not implemented! #endif } static OF_INLINE void* -of_atomic_sub_ptr(void* volatile *p, intptr_t i) +of_atomic_ptr_sub(void* volatile *p, intptr_t i) { #if !defined(OF_HAVE_THREADS) return (*(char* volatile*)p -= i); #elif defined(OF_X86_64_ASM) __asm__ __volatile__ ( @@ -225,16 +225,16 @@ return (void*)OSAtomicAdd64Barrier(-i, (int64_t*)p); # else return (void*)OSAtomicAdd32Barrier(-i, (int32_t*)p); # endif #else -# error of_atomic_sub_ptr not implemented! +# error of_atomic_ptr_sub not implemented! #endif } static OF_INLINE int -of_atomic_inc_int(volatile int *p) +of_atomic_int_inc(volatile int *p) { #if !defined(OF_HAVE_THREADS) return ++*p; #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int i; @@ -268,16 +268,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicIncrement32Barrier(p); #else -# error of_atomic_inc_int not implemented! +# error of_atomic_int_inc not implemented! #endif } static OF_INLINE int32_t -of_atomic_inc_32(volatile int32_t *p) +of_atomic_int32_inc(volatile int32_t *p) { #if !defined(OF_HAVE_THREADS) return ++*p; #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) uint32_t i; @@ -296,16 +296,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_add_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicIncrement32Barrier(p); #else -# error of_atomic_inc_32 not implemented! +# error of_atomic_int32_inc not implemented! #endif } static OF_INLINE int -of_atomic_dec_int(volatile int *p) +of_atomic_int_dec(volatile int *p) { #if !defined(OF_HAVE_THREADS) return --*p; #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) int i; @@ -339,16 +339,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicDecrement32Barrier(p); #else -# error of_atomic_dec_int not implemented! +# error of_atomic_int_dec not implemented! #endif } static OF_INLINE int32_t -of_atomic_dec_32(volatile int32_t *p) +of_atomic_int32_dec(volatile int32_t *p) { #if !defined(OF_HAVE_THREADS) return --*p; #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) uint32_t i; @@ -367,16 +367,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_sub_and_fetch(p, 1); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicDecrement32Barrier(p); #else -# error of_atomic_dec_32 not implemented! +# error of_atomic_int32_dec not implemented! #endif } static OF_INLINE unsigned int -of_atomic_or_int(volatile unsigned int *p, unsigned int i) +of_atomic_int_or(volatile unsigned int *p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p |= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) @@ -414,16 +414,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicOr32Barrier(i, p); #else -# error of_atomic_or_int not implemented! +# error of_atomic_int_or not implemented! #endif } static OF_INLINE uint32_t -of_atomic_or_32(volatile uint32_t *p, uint32_t i) +of_atomic_int32_or(volatile uint32_t *p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p |= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( @@ -443,16 +443,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_or_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicOr32Barrier(i, p); #else -# error of_atomic_or_32 not implemented! +# error of_atomic_int32_or not implemented! #endif } static OF_INLINE unsigned int -of_atomic_and_int(volatile unsigned int *p, unsigned int i) +of_atomic_int_and(volatile unsigned int *p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p &= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) @@ -490,16 +490,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAnd32Barrier(i, p); #else -# error of_atomic_and_int not implemented! +# error of_atomic_int_and not implemented! #endif } static OF_INLINE uint32_t -of_atomic_and_32(volatile uint32_t *p, uint32_t i) +of_atomic_int32_and(volatile uint32_t *p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p &= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( @@ -519,16 +519,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_and_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicAnd32Barrier(i, p); #else -# error of_atomic_and_32 not implemented! +# error of_atomic_int32_and not implemented! #endif } static OF_INLINE unsigned int -of_atomic_xor_int(volatile unsigned int *p, unsigned int i) +of_atomic_int_xor(volatile unsigned int *p, unsigned int i) { #if !defined(OF_HAVE_THREADS) return (*p ^= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) if (sizeof(int) == 4) @@ -566,16 +566,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicXor32Barrier(i, p); #else -# error of_atomic_xor_int not implemented! +# error of_atomic_int_xor not implemented! #endif } static OF_INLINE uint32_t -of_atomic_xor_32(volatile uint32_t *p, uint32_t i) +of_atomic_int32_xor(volatile uint32_t *p, uint32_t i) { #if !defined(OF_HAVE_THREADS) return (*p ^= i); #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( @@ -595,16 +595,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_xor_and_fetch(p, i); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicXor32Barrier(i, p); #else -# error of_atomic_xor_32 not implemented! +# error of_atomic_int32_xor not implemented! #endif } static OF_INLINE bool -of_atomic_cmpswap_int(volatile int *p, int o, int n) +of_atomic_int_cmpswap(volatile int *p, int o, int n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; @@ -628,16 +628,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_bool_compare_and_swap(p, o, n); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicCompareAndSwapIntBarrier(o, n, p); #else -# error of_atomic_cmpswap_int not implemented! +# error of_atomic_int_cmpswap not implemented! #endif } static OF_INLINE bool -of_atomic_cmpswap_32(volatile int32_t *p, int32_t o, int32_t n) +of_atomic_int32_cmpswap(volatile int32_t *p, int32_t o, int32_t n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; @@ -661,16 +661,16 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_bool_compare_and_swap(p, o, n); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicCompareAndSwap32Barrier(o, n, p); #else -# error of_atomic_cmpswap_32 not implemented! +# error of_atomic_int32_cmpswap not implemented! #endif } static OF_INLINE bool -of_atomic_cmpswap_ptr(void* volatile *p, void *o, void *n) +of_atomic_ptr_cmpswap(void* volatile *p, void *o, void *n) { #if !defined(OF_HAVE_THREADS) if (*p == o) { *p = n; return true; @@ -694,11 +694,11 @@ #elif defined(OF_HAVE_GCC_ATOMIC_OPS) return __sync_bool_compare_and_swap(p, o, n); #elif defined(OF_HAVE_OSATOMIC) return OSAtomicCompareAndSwapPtrBarrier(o, n, p); #else -# error of_atomic_cmpswap_ptr not implemented! +# error of_atomic_ptr_cmpswap not implemented! #endif } static OF_INLINE void of_memory_barrier(void)