From 7037da80cb8d2112ef71de2ea65ecc7a62c7e4e5 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 27 May 2015 13:17:28 +0300 Subject: [PATCH] Compilation fix --- Utilities/BEType.h | 11 ----------- Utilities/GNU.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index e0749e2e6c..acbefbe8c5 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -444,17 +444,6 @@ static __forceinline u128 sync_fetch_and_xor(volatile u128* dest, u128 value) } } -#if !defined(_MSC_VER) -#define sync_val_compare_and_swap __sync_val_compare_and_swap -#define sync_bool_compare_and_swap __sync_bool_compare_and_swap -#define sync_lock_test_and_set __sync_lock_test_and_set -#define sync_fetch_and_add __sync_fetch_and_add -#define sync_fetch_and_sub __sync_fetch_and_sub -#define sync_fetch_and_or __sync_fetch_and_or -#define sync_fetch_and_and __sync_fetch_and_and -#define sync_fetch_and_xor __sync_fetch_and_xor -#endif - #define re16(val) _byteswap_ushort(val) #define re32(val) _byteswap_ulong(val) #define re64(val) _byteswap_uint64(val) diff --git a/Utilities/GNU.h b/Utilities/GNU.h index ba584e3b99..deff6a051a 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -78,6 +78,46 @@ int clock_gettime(int foo, struct timespec *ts); #endif /* __APPLE__ */ +template static inline typename std::enable_if::value, T>::type sync_val_compare_and_swap(volatile T* dest, T comp, T exch) +{ + return __sync_val_compare_and_swap(dest, comp, exch); +} + +template static inline typename std::enable_if::value, bool>::type sync_bool_compare_and_swap(volatile T* dest, T comp, T exch) +{ + return __sync_bool_compare_and_swap(dest, comp, exch); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_test_and_set(volatile T* dest, T value) +{ + return __sync_lock_test_and_set(dest, value); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_add(volatile T* dest, T value) +{ + return __sync_lock_fetch_and_add(dest, value); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_sub(volatile T* dest, T value) +{ + return __sync_lock_fetch_and_sub(dest, value); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_or(volatile T* dest, T value) +{ + return __sync_lock_fetch_and_or(dest, value); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_and(volatile T* dest, T value) +{ + return __sync_lock_fetch_and_and(dest, value); +} + +template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_xor(volatile T* dest, T value) +{ + return __sync_lock_fetch_and_xor(dest, value); +} + #endif /* __GNUG__ */ #if defined(_MSC_VER)