Loading scripts/patches/mercury_c11_atomic.patch +21 −6 Original line number Diff line number Diff line diff --git a/src/util/mercury_atomic.h b/src/util/mercury_atomic.h index 63aa54e..b27f270 100644 index 63aa54e..92a0125 100644 --- a/src/util/mercury_atomic.h +++ b/src/util/mercury_atomic.h @@ -31,14 +31,34 @@ typedef OPA_int_t hg_atomic_int32_t; @@ -31,14 +31,31 @@ typedef OPA_int_t hg_atomic_int32_t; typedef OPA_ptr_t hg_atomic_int64_t; /* OPA has only limited 64-bit support */ # define HG_ATOMIC_VAR_INIT(x) OPA_PTR_T_INITIALIZER(x) #elif defined(HG_UTIL_HAS_STDATOMIC_H) Loading Loading @@ -33,12 +33,27 @@ index 63aa54e..b27f270 100644 +# define memory_order_acquire std::memory_order_acquire +# define memory_order_acq_rel std::memory_order_acq_rel +# define atomic_thread_fence std::atomic_thread_fence +# define atomic_fetch_add_explicit std::atomic_fetch_add_explicit +# endif +#define HG_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) + + + + #elif defined(__APPLE__) # include <libkern/OSAtomic.h> typedef struct { @@ -495,7 +512,7 @@ hg_atomic_incr64(hg_atomic_int64_t *ptr) #if defined(_WIN32) ret = InterlockedIncrementNoFence64(&ptr->value); #elif defined(HG_UTIL_HAS_STDATOMIC_H) && !defined(HG_UTIL_HAS_OPA_PRIMITIVES_H) - ret = atomic_fetch_add_explicit(ptr, 1, memory_order_acq_rel) + 1; + ret = atomic_fetch_add_explicit(ptr, 1l, memory_order_acq_rel) + 1; #elif defined(__APPLE__) ret = OSAtomicIncrement64(&ptr->value); #else @@ -517,7 +534,7 @@ hg_atomic_decr64(hg_atomic_int64_t *ptr) #if defined(_WIN32) ret = InterlockedDecrementNoFence64(&ptr->value); #elif defined(HG_UTIL_HAS_STDATOMIC_H) && !defined(HG_UTIL_HAS_OPA_PRIMITIVES_H) - ret = atomic_fetch_sub_explicit(ptr, 1, memory_order_acq_rel) - 1; + ret = atomic_fetch_sub_explicit(ptr, 1l, memory_order_acq_rel) - 1; #elif defined(__APPLE__) ret = OSAtomicDecrement64(&ptr->value); #else Loading
scripts/patches/mercury_c11_atomic.patch +21 −6 Original line number Diff line number Diff line diff --git a/src/util/mercury_atomic.h b/src/util/mercury_atomic.h index 63aa54e..b27f270 100644 index 63aa54e..92a0125 100644 --- a/src/util/mercury_atomic.h +++ b/src/util/mercury_atomic.h @@ -31,14 +31,34 @@ typedef OPA_int_t hg_atomic_int32_t; @@ -31,14 +31,31 @@ typedef OPA_int_t hg_atomic_int32_t; typedef OPA_ptr_t hg_atomic_int64_t; /* OPA has only limited 64-bit support */ # define HG_ATOMIC_VAR_INIT(x) OPA_PTR_T_INITIALIZER(x) #elif defined(HG_UTIL_HAS_STDATOMIC_H) Loading Loading @@ -33,12 +33,27 @@ index 63aa54e..b27f270 100644 +# define memory_order_acquire std::memory_order_acquire +# define memory_order_acq_rel std::memory_order_acq_rel +# define atomic_thread_fence std::atomic_thread_fence +# define atomic_fetch_add_explicit std::atomic_fetch_add_explicit +# endif +#define HG_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x) + + + + #elif defined(__APPLE__) # include <libkern/OSAtomic.h> typedef struct { @@ -495,7 +512,7 @@ hg_atomic_incr64(hg_atomic_int64_t *ptr) #if defined(_WIN32) ret = InterlockedIncrementNoFence64(&ptr->value); #elif defined(HG_UTIL_HAS_STDATOMIC_H) && !defined(HG_UTIL_HAS_OPA_PRIMITIVES_H) - ret = atomic_fetch_add_explicit(ptr, 1, memory_order_acq_rel) + 1; + ret = atomic_fetch_add_explicit(ptr, 1l, memory_order_acq_rel) + 1; #elif defined(__APPLE__) ret = OSAtomicIncrement64(&ptr->value); #else @@ -517,7 +534,7 @@ hg_atomic_decr64(hg_atomic_int64_t *ptr) #if defined(_WIN32) ret = InterlockedDecrementNoFence64(&ptr->value); #elif defined(HG_UTIL_HAS_STDATOMIC_H) && !defined(HG_UTIL_HAS_OPA_PRIMITIVES_H) - ret = atomic_fetch_sub_explicit(ptr, 1, memory_order_acq_rel) - 1; + ret = atomic_fetch_sub_explicit(ptr, 1l, memory_order_acq_rel) - 1; #elif defined(__APPLE__) ret = OSAtomicDecrement64(&ptr->value); #else