24 #include <my_atomic.h>
36 static inline int32
load_32(
volatile int32 *ptr)
40 result= my_atomic_load32(ptr);
46 static inline int64
load_64(
volatile int64 *ptr)
50 result= my_atomic_load64(ptr);
56 static inline uint32
load_u32(
volatile uint32 *ptr)
60 result= (uint32) my_atomic_load32((int32*) ptr);
66 static inline uint64
load_u64(
volatile uint64 *ptr)
70 result= (uint64) my_atomic_load64((int64*) ptr);
76 static inline void store_32(
volatile int32 *ptr, int32 value)
79 my_atomic_store32(ptr, value);
84 static inline void store_64(
volatile int64 *ptr, int64 value)
87 my_atomic_store64(ptr, value);
92 static inline void store_u32(
volatile uint32 *ptr, uint32 value)
95 my_atomic_store32((int32*) ptr, (int32) value);
100 static inline void store_u64(
volatile uint64 *ptr, uint64 value)
103 my_atomic_store64((int64*) ptr, (int64) value);
108 static inline int32
add_32(
volatile int32 *ptr, int32 value)
112 result= my_atomic_add32(ptr, value);
118 static inline int64
add_64(
volatile int64 *ptr, int64 value)
122 result= my_atomic_add64(ptr, value);
128 static inline uint32
add_u32(
volatile uint32 *ptr, uint32 value)
132 result= (uint32) my_atomic_add32((int32*) ptr, (int32) value);
138 static inline uint64
add_u64(
volatile uint64 *ptr, uint64 value)
142 result= (uint64) my_atomic_add64((int64*) ptr, (int64) value);
148 static inline bool cas_32(
volatile int32 *ptr, int32 *old_value,
153 result= my_atomic_cas32(ptr, old_value, new_value);
159 static inline bool cas_64(
volatile int64 *ptr, int64 *old_value,
164 result= my_atomic_cas64(ptr, old_value, new_value);
170 static inline bool cas_u32(
volatile uint32 *ptr, uint32 *old_value,
175 result= my_atomic_cas32((int32*) ptr, (int32*) old_value,
182 static inline bool cas_u64(
volatile uint64 *ptr, uint64 *old_value,
187 result= my_atomic_cas64((int64*) ptr, (int64*) old_value,
206 uint
index= (((intptr) ptr) >> 3) & 0xFF;
215 static inline void rdlock(
volatile void *ptr)
217 my_atomic_rwlock_rdlock(get_rwlock(ptr));
224 static inline void wrlock(
volatile void *ptr)
226 my_atomic_rwlock_wrlock(get_rwlock(ptr));
233 static inline void rdunlock(
volatile void *ptr)
235 my_atomic_rwlock_rdunlock(get_rwlock(ptr));
242 static inline void wrunlock(
volatile void *ptr)
244 my_atomic_rwlock_wrunlock(get_rwlock(ptr));