#if !defined(AO_ATOMIC_OPS_H) || defined(AO_ATOMIC_OPS_INCLUDED)
# error This file should not be included directly.
#endif
#include "../all_aligned_atomic_load_store.h"
#ifndef AO_ASSUME_WINDOWS98
# define AO_ASSUME_WINDOWS98
#endif
#ifndef AO_USE_INTERLOCKED_INTRINSICS
# define AO_USE_INTERLOCKED_INTRINSICS
#endif
#include "common32_defs.h"
#ifndef AO_HAVE_test_and_set_full
# include "../test_and_set_t_is_ao_t.h"
#endif
#ifndef AO_NO_DOUBLE_CAS
# include "../standard_ao_double_t.h"
# pragma intrinsic (_InterlockedCompareExchange128)
# pragma intrinsic (_InterlockedCompareExchange128_acq)
# pragma intrinsic (_InterlockedCompareExchange128_nf)
# pragma intrinsic (_InterlockedCompareExchange128_rel)
AO_INLINE int
AO_compare_double_and_swap_double(volatile AO_double_t *addr,
AO_t old_val1, AO_t old_val2,
AO_t new_val1, AO_t new_val2)
{
__int64 comparandResult[2];
AO_ASSERT_ADDR_ALIGNED(addr);
comparandResult[0] = old_val1;
comparandResult[1] = old_val2;
return _InterlockedCompareExchange128_nf((volatile __int64 *)addr,
new_val2 ,
new_val1 ,
comparandResult);
}
# define AO_HAVE_compare_double_and_swap_double
AO_INLINE int
AO_compare_double_and_swap_double_acquire(volatile AO_double_t *addr,
AO_t old_val1, AO_t old_val2,
AO_t new_val1, AO_t new_val2)
{
__int64 comparandResult[2];
AO_ASSERT_ADDR_ALIGNED(addr);
comparandResult[0] = old_val1;
comparandResult[1] = old_val2;
return _InterlockedCompareExchange128_acq((volatile __int64 *)addr,
new_val2 ,
new_val1 ,
comparandResult);
}
# define AO_HAVE_compare_double_and_swap_double_acquire
AO_INLINE int
AO_compare_double_and_swap_double_release(volatile AO_double_t *addr,
AO_t old_val1, AO_t old_val2,
AO_t new_val1, AO_t new_val2)
{
__int64 comparandResult[2];
AO_ASSERT_ADDR_ALIGNED(addr);
comparandResult[0] = old_val1;
comparandResult[1] = old_val2;
return _InterlockedCompareExchange128_rel((volatile __int64 *)addr,
new_val2 ,
new_val1 ,
comparandResult);
}
# define AO_HAVE_compare_double_and_swap_double_release
AO_INLINE int
AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
AO_t old_val1, AO_t old_val2,
AO_t new_val1, AO_t new_val2)
{
__int64 comparandResult[2];
AO_ASSERT_ADDR_ALIGNED(addr);
comparandResult[0] = old_val1;
comparandResult[1] = old_val2;
return _InterlockedCompareExchange128((volatile __int64 *)addr,
new_val2 ,
new_val1 ,
comparandResult);
}
# define AO_HAVE_compare_double_and_swap_double_full
#endif