util/u_atomic: Fix the unlocked implementation.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 25 Nov 2014 14:25:28 +0000 (14:25 +0000)
committerMatt Turner <mattst88@gmail.com>
Mon, 1 Dec 2014 19:28:45 +0000 (11:28 -0800)
commita5299e9e1ca45f7bcf72347dc0fd47986d779769
tree4dfa9ecf1d5c492dce92cea5f931208573b1d834
parentff80b92a58ef802e2721d1b51da6157be696c932
util/u_atomic: Fix the unlocked implementation.

It was totally broken:

- p_atomic_dec_zero() was returning the negation of the expected value

- p_atomic_inc_return()/p_atomic_dec_return() was
  post-incrementing/decrementing, hence returning the old value instead
  of the new

- p_atomic_cmpxchg() was returning the new value on success, instead of
  the old

It is clear this never used in the past. I wonder if it wouldn't be better to
yank it altogether.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/util/u_atomic.h