8#ifndef INCLUDED_BSLS_ATOMICOPERATIONS_X64_WIN_MSVC
9#define INCLUDED_BSLS_ATOMICOPERATIONS_X64_WIN_MSVC
55#include <bsls_atomicoperations_default.h>
59#if defined(BSLS_PLATFORM_CPU_X86_64) && defined(BSLS_PLATFORM_CMP_MSVC)
81struct AtomicOperations_X64_WIN_MSVC;
82typedef AtomicOperations_X64_WIN_MSVC AtomicOperations_Imp;
89struct Atomic_TypeTraits<AtomicOperations_X64_WIN_MSVC>
100 volatile Types::Int64 d_value;
106 volatile
unsigned int d_value;
112 volatile Types::Uint64 d_value;
118 void * volatile d_value;
126struct AtomicOperations_X64_WIN_MSVC
127 : AtomicOperations_Default64<AtomicOperations_X64_WIN_MSVC>
129 typedef Atomic_TypeTraits<AtomicOperations_X64_WIN_MSVC> AtomicTypes;
133 static int getInt(
const AtomicTypes::Int *atomicInt);
135 static int getIntAcquire(
const AtomicTypes::Int *atomicInt);
137 static void setInt(AtomicTypes::Int *atomicInt,
int value);
139 static void setIntRelease(AtomicTypes::Int *atomicInt,
int value);
141 static int swapInt(AtomicTypes::Int *atomicInt,
int swapValue);
143 static int testAndSwapInt(AtomicTypes::Int *atomicInt,
147 static int addIntNv(AtomicTypes::Int *atomicInt,
int value);
151 static Types::Int64 getInt64(
const AtomicTypes::Int64 *atomicInt);
153 static Types::Int64 getInt64Acquire(
const AtomicTypes::Int64 *atomicInt);
155 static void setInt64(AtomicTypes::Int64 *atomicInt, Types::Int64 value);
157 static void setInt64Release(AtomicTypes::Int64 *atomicInt,
160 static Types::Int64 swapInt64(AtomicTypes::Int64 *atomicInt,
161 Types::Int64 swapValue);
163 static Types::Int64 testAndSwapInt64(AtomicTypes::Int64 *atomicInt,
164 Types::Int64 compareValue,
165 Types::Int64 swapValue);
167 static Types::Int64 addInt64Nv(AtomicTypes::Int64 *atomicInt,
180#define BSLS_ATOMIC_FENCE() \
184int AtomicOperations_X64_WIN_MSVC::
185 getInt(
const AtomicTypes::Int *atomicInt)
188 return atomicInt->d_value;
192int AtomicOperations_X64_WIN_MSVC::
193 getIntAcquire(
const AtomicTypes::Int *atomicInt)
195 return atomicInt->d_value;
199void AtomicOperations_X64_WIN_MSVC::
200 setInt(AtomicTypes::Int *atomicInt,
int value)
202 atomicInt->d_value = value;
207void AtomicOperations_X64_WIN_MSVC::
208 setIntRelease(AtomicTypes::Int *atomicInt,
int value)
210 atomicInt->d_value = value;
214int AtomicOperations_X64_WIN_MSVC::
215 swapInt(AtomicTypes::Int *atomicInt,
int swapValue)
217 return _InterlockedExchange(
218 reinterpret_cast<long volatile *
>(&atomicInt->d_value),
223int AtomicOperations_X64_WIN_MSVC::
224 testAndSwapInt(AtomicTypes::Int *atomicInt,
228 return _InterlockedCompareExchange(
229 reinterpret_cast<long volatile *
>(&atomicInt->d_value),
235int AtomicOperations_X64_WIN_MSVC::
236 addIntNv(AtomicTypes::Int *atomicInt,
int value)
238 return static_cast<unsigned>(_InterlockedExchangeAdd(
239 reinterpret_cast<long volatile *
>(
240 &atomicInt->d_value),
246Types::Int64 AtomicOperations_X64_WIN_MSVC::
247 getInt64(
const AtomicTypes::Int64 *atomicInt)
250 return atomicInt->d_value;
254Types::Int64 AtomicOperations_X64_WIN_MSVC::
255 getInt64Acquire(
const AtomicTypes::Int64 *atomicInt)
257 return atomicInt->d_value;
261void AtomicOperations_X64_WIN_MSVC::
262 setInt64(AtomicTypes::Int64 *atomicInt, Types::Int64 value)
264 atomicInt->d_value = value;
269void AtomicOperations_X64_WIN_MSVC::
270 setInt64Release(AtomicTypes::Int64 *atomicInt,
273 atomicInt->d_value = value;
277Types::Int64 AtomicOperations_X64_WIN_MSVC::
278 swapInt64(AtomicTypes::Int64 *atomicInt,
279 Types::Int64 swapValue)
281 return _InterlockedExchange64(&atomicInt->d_value, swapValue);
285Types::Int64 AtomicOperations_X64_WIN_MSVC::
286 testAndSwapInt64(AtomicTypes::Int64 *atomicInt,
287 Types::Int64 compareValue,
288 Types::Int64 swapValue)
290 return _InterlockedCompareExchange64(
297Types::Int64 AtomicOperations_X64_WIN_MSVC::
298 addInt64Nv(AtomicTypes::Int64 *atomicInt,
301 return static_cast<Types::Uint64
>(_InterlockedExchangeAdd64(
307#undef BSLS_ATOMIC_FENCE
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlt_iso8601util.h:691