medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1b66c3eec66107d639e015e3de45ceab38c2a03d
parent 6ddff6f3a2c4c03269b649cfb4ec3a9a9ae3a0cf
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Dec 13 23:13:21 +0200

Add fetch_sub_*

Diffstat:
platform_atomic.h | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/platform_atomic.h b/platform_atomic.h @@ -37,26 +37,31 @@ struct atomic_u64 { #define load_relaxed( atom ) __atomic_load_n( &( atom )->v, __ATOMIC_RELAXED ) #define store_relaxed( atom, x ) __atomic_store_n( &( atom )->v, ( x ), __ATOMIC_RELAXED ) #define fetch_add_relaxed( atom, x ) __atomic_fetch_add( &( atom )->v, ( x ), __ATOMIC_RELAXED ) +#define fetch_sub_relaxed( atom, x ) __atomic_fetch_sub( &( atom )->v, ( x ), __ATOMIC_RELAXED ) #define exchange_relaxed( atom, x ) __atomic_exchange_n( &( atom )->v, ( x ), __ATOMIC_RELAXED ) #define compare_exchange_relaxed( atom, before, after ) __atomic_compare_exchange_n( &( atom )->v, ( before ), ( after ), false, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) #define load_acquire( atom ) __atomic_load_n( &( atom )->v, __ATOMIC_ACQUIRE ) #define fetch_add_acquire( atom, x ) __atomic_fetch_add( &( atom )->v, ( x ), __ATOMIC_ACQUIRE ) +#define fetch_sub_acquire( atom, x ) __atomic_fetch_sub( &( atom )->v, ( x ), __ATOMIC_ACQUIRE ) #define exchange_acquire( atom, x ) __atomic_exchange_n( &( atom )->v, ( x ), __ATOMIC_ACQUIRE ) #define compare_exchange_acquire( atom, before, after ) __atomic_compare_exchange_n( &( atom )->v, ( before ), ( after ), false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE ) #define store_release( atom, x ) __atomic_store_n( &( atom )->v, ( x ), __ATOMIC_RELEASE ) #define fetch_add_release( atom, x ) __atomic_fetch_add( &( atom )->v, ( x ), __ATOMIC_RELEASE ) +#define fetch_sub_release( atom, x ) __atomic_fetch_sub( &( atom )->v, ( x ), __ATOMIC_RELEASE ) #define exchange_release( atom, x ) __atomic_exchange_n( &( atom )->v, ( x ), __ATOMIC_RELEASE ) #define compare_exchange_release( atom, before, after ) __atomic_compare_exchange_n( &( atom )->v, ( before ), ( after ), false, __ATOMIC_RELEASE, __ATOMIC_RELAXED ) #define fetch_add_acqrel( atom, x ) __atomic_fetch_add( &( atom )->v, ( x ), __ATOMIC_ACQ_REL ) +#define fetch_sub_acqrel( atom, x ) __atomic_fetch_sub( &( atom )->v, ( x ), __ATOMIC_ACQ_REL ) #define exchange_acqrel( atom, x ) __atomic_exchange_n( &( atom )->v, ( x ), __ATOMIC_ACQ_REL ) #define compare_exchange_acqrel( atom, before, after ) __atomic_compare_exchange_n( &( atom )->v, ( before ), ( after ), false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE ) #define load_seqcst( atom ) __atomic_load_n( &( atom )->v, __ATOMIC_SEQ_CST ) #define store_seqcst( atom, x ) __atomic_store_n( &( atom )->v, ( x ), __ATOMIC_SEQ_CST ) #define fetch_add_seqcst( atom, x ) __atomic_fetch_add( &( atom )->v, ( x ), __ATOMIC_SEQ_CST ) +#define fetch_sub_seqcst( atom, x ) __atomic_fetch_sub( &( atom )->v, ( x ), __ATOMIC_SEQ_CST ) #define exchange_seqcst( atom, x ) __atomic_exchange_n( &( atom )->v, ( x ), __ATOMIC_SEQ_CST ) #define compare_exchange_seqcst( atom, before, after ) __atomic_compare_exchange_n( &( atom )->v, ( before ), ( after ), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) @@ -95,26 +100,31 @@ struct atomic_u64 { #define load_relaxed( atom ) ( atom )->load( std::memory_order_relaxed ) #define store_relaxed( atom, x ) ( atom )->store( x, std::memory_order_relaxed ) #define fetch_add_relaxed( atom, x ) ( atom )->fetch_add( x, std::memory_order_relaxed ) +#define fetch_sub_relaxed( atom, x ) ( atom )->fetch_sub( x, std::memory_order_relaxed ) #define exchange_relaxed( atom, x ) ( atom )->exchange( x, std::memory_order_relaxed ) #define compare_exchange_relaxed( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_relaxed, std::memory_order_relaxed ) #define load_acquire( atom ) ( atom )->load( std::memory_order_acquire ) #define fetch_add_acquire( atom, x ) ( atom )->fetch_add( x, std::memory_order_acquire ) +#define fetch_sub_acquire( atom, x ) ( atom )->fetch_sub( x, std::memory_order_acquire ) #define exchange_acquire( atom, x ) ( atom )->exchange( x, std::memory_order_acquire ) #define compare_exchange_acquire( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_acquire, std::memory_order_acquire ) #define store_release( atom, x ) ( atom )->store( x, std::memory_order_release ) #define fetch_add_release( atom, x ) ( atom )->fetch_add( x, std::memory_order_release ) +#define fetch_sub_release( atom, x ) ( atom )->fetch_sub( x, std::memory_order_release ) #define exchange_release( atom, x ) ( atom )->exchange( x, std::memory_order_release ) #define compare_exchange_release( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_release, std::memory_order_relaxed ) #define fetch_add_acqrel( atom, x ) ( atom )->fetch_add( x, std::memory_order_acq_rel ) +#define fetch_sub_acqrel( atom, x ) ( atom )->fetch_sub( x, std::memory_order_acq_rel ) #define exchange_acqrel( atom, x ) ( atom )->exchange( x, std::memory_order_acq_rel ) #define compare_exchange_acqrel( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_acq_rel, std::memory_order_acquire ) #define load_seqcst( atom ) ( atom )->load( std::memory_order_seq_cst ) #define store_seqcst( atom, x ) ( atom )->store( x, std::memory_order_seq_cst ) #define fetch_add_seqcst( atom, x ) ( atom )->fetch_add( x, std::memory_order_seq_cst ) +#define fetch_sub_seqcst( atom, x ) ( atom )->fetch_sub( x, std::memory_order_seq_cst ) #define exchange_seqcst( atom, x ) ( atom )->exchange( x, std::memory_order_seq_cst ) #define compare_exchange_seqcst( atom, before, after ) ( atom )->compare_exchange_strong( *( before ), after, std::memory_order_seq_cst, std::memory_order_seq_cst )