/* _Atomic_compare_exchange_weak_2, _Atomic_compare_exchange_strong_2 */ static int _Compare_exchange_seq_cst_2(volatile _Uint2_t *_Tgt, _Uint2_t *_Exp, _Uint2_t _Value) { /* compare and exchange values atomically with sequentially consistent memory order */ _Uint1_t res; _Uint2_t prev = _InterlockedCompareExchange16((volatile short *)_Tgt, _Value, *_Exp); if (prev == *_Exp) res = 1; else { /* copy old value */ res = 0; *_Exp = prev; } return (res); }
short test_InterlockedCompareExchange16(short volatile *Destination, short Exchange, short Comperand) { return _InterlockedCompareExchange16(Destination, Exchange, Comperand); }