From 3b347f2ba5f6daa9f8a0f5fbb761a12a10553c05 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 1 Jul 2020 11:06:58 +0200 Subject: [PATCH] Reduce some warnings using the atomic compatibility layer (cannot fix all) --- m-atomic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/m-atomic.h b/m-atomic.h index 8590dd50..d5252943 100644 --- a/m-atomic.h +++ b/m-atomic.h @@ -222,7 +222,7 @@ static inline long long atomic_fetch_unlock (m_mutex_t *lock, long long val) (m_mutex_lock((ptr)->_lock), \ (ptr)->_previous = (ptr)->_val, \ (ptr)->_val op (val), \ - atomic_fetch_unlock(&(ptr)->_lock, (ptr)->_previous-(ptr)->_zero)+(ptr)->_zero) + atomic_fetch_unlock(&(ptr)->_lock, (long long)((ptr)->_previous-(ptr)->_zero))+(ptr)->_zero) /* Perform an atomic add (EMULATION) */ #define atomic_fetch_add(ptr, val) atomic_fetch_op(ptr, val, +=) @@ -249,7 +249,7 @@ static inline long long atomic_fetch_unlock (m_mutex_t *lock, long long val) #define atomic_load_lock(ptr) \ (m_mutex_lock((ptr)->_lock), \ (ptr)->_previous = (ptr)->_val, \ - atomic_fetch_unlock(&(ptr)->_lock, (ptr)->_previous-(ptr)->_zero)+(ptr)->_zero) + atomic_fetch_unlock(&(ptr)->_lock, (long long) ((ptr)->_previous-(ptr)->_zero))+(ptr)->_zero) /* (INTERNAL) Store an atomic variable within a lock (needed for variable greater than CPU atomic size) */ @@ -273,7 +273,7 @@ static inline long long atomic_fetch_unlock (m_mutex_t *lock, long long val) if ( sizeof ((ptr)->_val) <= ATOMICI_MIN_RW_SIZE) { \ (ptr)->_val = (val); \ } else { \ - long long _offset = (val) - (ptr)->_zero; \ + long long _offset = (long long) ((val) - (ptr)->_zero); \ atomic_store_lock(ptr, (ptr)->_zero + _offset); \ } \ } while (0)