This commit is contained in:
Behdad Esfahbod 2017-05-16 14:26:28 -07:00
parent 152736981d
commit 1817221620
1 changed files with 4 additions and 4 deletions

View File

@ -124,13 +124,13 @@ typedef unsigned int hb_atomic_int_impl_t;
#include <builtins.h> #include <builtins.h>
static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) { static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
__lwsync(); __lwsync();
int result = __fetch_and_add(AI, V); int result = __fetch_and_add(AI, V);
__isync(); __isync();
return result; return result;
} }
static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) { static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
__sync(); __sync();
int result = __compare_and_swaplp (P, &O, N); int result = __compare_and_swaplp (P, &O, N);
__sync(); __sync();
@ -139,10 +139,10 @@ static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
typedef int hb_atomic_int_impl_t; typedef int hb_atomic_int_impl_t;
#define HB_ATOMIC_INT_IMPL_INIT(V) (V) #define HB_ATOMIC_INT_IMPL_INIT(V) (V)
#define hb_atomic_int_impl_add(AI, V) hb_fetch_and_add (&(AI), (V)) #define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add (&(AI), (V))
#define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P)) #define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N)) #define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
#elif !defined(HB_NO_MT) #elif !defined(HB_NO_MT)