about summary refs log tree commit diff
path: root/include/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/atomic.h')
-rw-r--r--include/atomic.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/atomic.h b/include/atomic.h
index afebb789a3..3a0ec3a4be 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -189,13 +189,15 @@
 
 #ifndef atomic_add_negative
 # define atomic_add_negative(mem, value) \
-  (atomic_exchange_and_add ((mem), (value)) < 0)
+  ({ __typeof (value) __value = (value);				      \
+     atomic_exchange_and_add ((mem), __value) < -__value); })
 #endif
 
 
 #ifndef atomic_add_zero
 # define atomic_add_zero(mem, value) \
-  (atomic_exchange_and_add ((mem), (value)) == 0)
+  ({ __typeof (value) __value = (value);				      \
+     atomic_exchange_and_add ((mem), __value) == -__value; })
 #endif