From: Christoph Bumiller <christoph.bumil...@speed.at> Signed-off-by: David Heidelberger <david.heidelber...@ixit.cz> --- src/gallium/auxiliary/util/u_atomic.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_atomic.h b/src/gallium/auxiliary/util/u_atomic.h index b99ccc9..3f58504 100644 --- a/src/gallium/auxiliary/util/u_atomic.h +++ b/src/gallium/auxiliary/util/u_atomic.h @@ -154,6 +154,12 @@ p_atomic_inc(int32_t *v) (void) __sync_add_and_fetch(v, 1); } +static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return __sync_add_and_fetch(v, 1); +} + static INLINE void p_atomic_dec(int32_t *v) { @@ -161,6 +167,12 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return __sync_sub_and_fetch(v, 1); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return __sync_val_compare_and_swap(v, old, _new); @@ -186,6 +198,8 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) #define p_atomic_dec_zero(_v) ((boolean) --(*(_v))) #define p_atomic_inc(_v) ((void) (*(_v))++) #define p_atomic_dec(_v) ((void) (*(_v))--) +#define p_atomic_inc_return(_v) ((*(_v))++) +#define p_atomic_dec_return(_v) ((*(_v))--) #define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v)) #endif @@ -288,6 +302,12 @@ p_atomic_inc(int32_t *v) _InterlockedIncrement((long *)v); } +static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return _InterlockedIncrement((long *)v); +} + static INLINE void p_atomic_dec(int32_t *v) { @@ -295,6 +315,12 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return _InterlockedDecrement((long *)v); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return _InterlockedCompareExchange((long *)v, _new, old); -- 2.1.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev