diff mbox

[RFC,11/22] add QEMU style defines for __sync_add_and_fetch

Message ID 20160825134421.20231-12-pbutsykin@virtuozzo.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pavel Butsykin Aug. 25, 2016, 1:44 p.m. UTC
Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 include/qemu/atomic.h | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 7e13fca..acf8f68 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -152,6 +152,9 @@ 
     _old;                                                               \
     })
 
+#define atomic_inc_fetch(ptr)  __sync_add_and_fetch(ptr, 1)
+#define atomic_dec_fetch(ptr)  __sync_add_and_fetch(ptr, -1)
+
 /* Provide shorter names for GCC atomic builtins, return old value */
 #define atomic_fetch_inc(ptr)  __atomic_fetch_add(ptr, 1, __ATOMIC_SEQ_CST)
 #define atomic_fetch_dec(ptr)  __atomic_fetch_sub(ptr, 1, __ATOMIC_SEQ_CST)