qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PATCH RFC 11/22] add QEMU style defines for __sync_add_and


From: Pavel Butsykin
Subject: [Qemu-block] [PATCH RFC 11/22] add QEMU style defines for __sync_add_and_fetch
Date: Thu, 25 Aug 2016 16:44:10 +0300

Signed-off-by: Pavel Butsykin <address@hidden>
---
 include/qemu/atomic.h | 3 +++
 1 file changed, 3 insertions(+)

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)
-- 
2.8.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]