#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"
#if !defined(AO_ASSUME_VISTA) && _MSC_VER >= 1910
# define AO_ASSUME_VISTA
#endif
#if !defined(AO_ASSUME_WINDOWS98) \
&& (defined(AO_ASSUME_VISTA) || _MSC_VER >= 1400)
# define AO_ASSUME_WINDOWS98
#endif
#if !defined(AO_USE_PENTIUM4_INSTRS) && _M_IX86_FP >= 2
# define AO_USE_PENTIUM4_INSTRS
#endif
#define AO_T_IS_INT
#ifndef AO_USE_INTERLOCKED_INTRINSICS
# define AO_USE_INTERLOCKED_INTRINSICS
#endif
#include "common32_defs.h"
#ifdef AO_NO_ASM_XCHG
#else
# ifdef AO_USE_PENTIUM4_INSTRS
AO_INLINE void
AO_nop_full(void)
{
__asm { mfence }
}
# define AO_HAVE_nop_full
# else
# endif
#endif
#if !defined(AO_NO_ASM_XADD) && !defined(AO_HAVE_char_fetch_and_add_full)
AO_INLINE unsigned char
AO_char_fetch_and_add_full(volatile unsigned char *p, unsigned char incr)
{
__asm
{
mov al, incr
mov ebx, p
lock xadd byte ptr [ebx], al
}
}
# define AO_HAVE_char_fetch_and_add_full
AO_INLINE unsigned short
AO_short_fetch_and_add_full(volatile unsigned short *p, unsigned short incr)
{
__asm
{
mov ax, incr
mov ebx, p
lock xadd word ptr [ebx], ax
}
}
# define AO_HAVE_short_fetch_and_add_full
#endif
#ifndef AO_HAVE_test_and_set_full
# ifdef AO_NO_ASM_XCHG
# include "../test_and_set_t_is_ao_t.h"
# else
# include "../test_and_set_t_is_char.h"
# endif
AO_INLINE AO_TS_VAL_t
AO_test_and_set_full(volatile AO_TS_t *addr)
{
# ifdef AO_NO_ASM_XCHG
return _InterlockedExchange((long AO_INTERLOCKED_VOLATILE *)addr,
AO_TS_SET);
# else
__asm
{
mov eax,0xff ;
mov ebx,addr ;
xchg byte ptr [ebx],al ;
}
# endif
}
# define AO_HAVE_test_and_set_full
#endif
#if defined(_WIN64) && !defined(CPPCHECK)
# error wrong architecture
#endif
#ifdef AO_ASSUME_VISTA
# include "../standard_ao_double_t.h"
# define AO_ACCESS_double_CHECK_ALIGNED
# include "../loadstore/double_atomic_load_store.h"
# pragma intrinsic (_InterlockedCompareExchange64)
AO_INLINE int
AO_double_compare_and_swap_full(volatile AO_double_t *addr,
AO_double_t old_val, AO_double_t new_val)
{
AO_ASSERT_ADDR_ALIGNED(addr);
return (double_ptr_storage)_InterlockedCompareExchange64(
(__int64 volatile *)addr,
new_val.AO_whole ,
old_val.AO_whole) == old_val.AO_whole;
}
# define AO_HAVE_double_compare_and_swap_full
#endif
#include "../ordered_except_wr.h"