diff --git a/include/ucore/atomic.h b/include/ucore/atomic.h index a3b4a67..7d7821e 100644 --- a/include/ucore/atomic.h +++ b/include/ucore/atomic.h @@ -8,17 +8,18 @@ #ifdef __GNUC__ +/** + * Atomically subtract val from *ptr + * @return *ptr before the subtraction + */ +#define UC_ATOMIC_SUB(ptr, val) __sync_fetch_and_add((ptr), -(val)) + /** * Atomically add val to *ptr * @return *ptr before the addition */ #define UC_ATOMIC_ADD(ptr, val) __sync_fetch_and_add((ptr), (val)) -/** - * Atomically subtract val from *ptr - * @return *ptr before the subtraction - */ -#define UC_ATOMIC_SUB(ptr, val) __sync_fetch_and_add((ptr), -(val)) /** * Atomically decrement *ptr