qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire


From: Pranith Kumar
Subject: [Qemu-devel] [PATCH] atomic.h: Use __atomic_load_n() for acquire
Date: Tue, 1 Nov 2016 10:33:03 -0400

We can use __atomic_load_n() saving a store and load from the _val.

Signed-off-by: Pranith Kumar <address@hidden>
---
 include/qemu/atomic.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 878fa07..6775603 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -144,9 +144,7 @@
 #define atomic_load_acquire(ptr)                        \
     ({                                                  \
     QEMU_BUILD_BUG_ON(sizeof(*ptr) > sizeof(void *));   \
-    typeof_strip_qual(*ptr) _val;                       \
-    __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE);        \
-    _val;                                               \
+    __atomic_load_n(ptr, __ATOMIC_ACQUIRE);             \
     })
 
 #define atomic_store_release(ptr, i)  do {              \
-- 
2.10.2




reply via email to

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