\hypertarget{a00749_source}{}\doxysection{AAX\+\_\+\+Atomic.\+h}
\label{a00749_source}\index{AAX\_Atomic.h@{AAX\_Atomic.h}}
\mbox{\hyperlink{a00749}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ \ Copyright\ 2013-\/2015,\ 2018,\ 2023-\/2024\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ This\ file\ is\ part\ of\ the\ Avid\ AAX\ SDK.}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ The\ AAX\ SDK\ is\ subject\ to\ commercial\ or\ open-\/source\ licensing.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ By\ using\ the\ AAX\ SDK,\ you\ agree\ to\ the\ terms\ of\ both\ the\ Avid\ AAX\ SDK\ License}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ Agreement\ and\ Avid\ Privacy\ Policy.}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ AAX\ SDK\ License:\ https://developer.avid.com/aax}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ Privacy\ Policy:\ https://www.avid.com/legal/privacy-\/policy-\/statement}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ Or:\ You\ may\ also\ use\ this\ code\ under\ the\ terms\ of\ the\ GPL\ v3\ (see}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ \ www.gnu.org/licenses).}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ \ THE\ AAX\ SDK\ IS\ PROVIDED\ "{}AS\ IS"{}\ WITHOUT\ ANY\ WARRANTY,\ AND\ ALL\ WARRANTIES,\ WHETHER}}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ \ EXPRESSED\ OR\ IMPLIED,\ INCLUDING\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ PURPOSE,\ ARE}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ \ DISCLAIMED.}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00030\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#ifndef\ AAX\_ATOMIC\_H\_}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ AAX\_ATOMIC\_H\_}}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00542}{AAX.h}}"{}}}
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \textcolor{preprocessor}{\#if\ (!defined\ AAX\_PointerSize)}}
\DoxyCodeLine{00042\ \textcolor{preprocessor}{\#error\ Undefined\ pointer\ size}}
\DoxyCodeLine{00043\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00047\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_a56633d7039fae1d31c8984f9baafa17e}{AAX\_Atomic\_IncThenGet\_32}}(uint32\_t\ \&\ ioData);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00050\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_adb8e12a71f90de1328a4fde6dd22fc41}{AAX\_Atomic\_DecThenGet\_32}}(uint32\_t\ \&\ ioData);}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00053\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_a44eb82707be40dd559db9051317c10d0}{AAX\_Atomic\_Exchange\_32}}(}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keyword}{volatile}\ uint32\_t\&\ ioValue,}
\DoxyCodeLine{00055\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue);}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00058\ uint64\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_a0a683337ef8627f1e2b01e69d5f11cb0}{AAX\_Atomic\_Exchange\_64}}(}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ ioValue,}
\DoxyCodeLine{00060\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue);}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00063\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>\ TPointer*\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_add2856260ffb4309c4e515bac8490bea}{AAX\_Atomic\_Exchange\_Pointer}}(TPointer*\&\ ioValue,\ TPointer*\ inExchangeValue)}
\DoxyCodeLine{00064\ \{}
\DoxyCodeLine{00065\ \textcolor{preprocessor}{\#if\ (AAX\_PointerSize\ ==\ AAXPointer\_64bit)}}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordflow}{return}\ (TPointer*)\mbox{\hyperlink{a00749_a0a683337ef8627f1e2b01e69d5f11cb0}{AAX\_Atomic\_Exchange\_64}}(*(uint64\_t*)(\textcolor{keywordtype}{void}*)\&ioValue,\ (uint64\_t)inExchangeValue);}
\DoxyCodeLine{00067\ \textcolor{preprocessor}{\#elif\ (AAX\_PointerSize\ ==\ AAXPointer\_32bit)}}
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordflow}{return}\ (TPointer*)\mbox{\hyperlink{a00749_a44eb82707be40dd559db9051317c10d0}{AAX\_Atomic\_Exchange\_32}}(*(uint32\_t*)(\textcolor{keywordtype}{void}*)\&ioValue,\ (uint32\_t)inExchangeValue);}
\DoxyCodeLine{00069\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00070\ \textcolor{preprocessor}{\#error\ Unsupported\ pointer\ size}}
\DoxyCodeLine{00071\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00072\ \}}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00075\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_a74a2bdb895976193bdfe4cd2fe31e21e}{AAX\_Atomic\_CompareAndExchange\_32}}(}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keyword}{volatile}\ uint32\_t\ \&\ ioValue,}
\DoxyCodeLine{00077\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00078\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue);}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00081\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_ae1e5b0cf8d8c7a301e13772a57a3d2fd}{AAX\_Atomic\_CompareAndExchange\_64}}(}
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ \ ioValue,}
\DoxyCodeLine{00083\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00084\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue);}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00087\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_ab1c7611e7c95fd61900b8e5a44c36e63}{AAX\_Atomic\_CompareAndExchange\_Pointer}}(TPointer*\&\ ioValue,\ TPointer*\ inCompareValue,\ TPointer*\ inExchangeValue)}
\DoxyCodeLine{00088\ \{}
\DoxyCodeLine{00089\ \textcolor{preprocessor}{\#if\ (AAX\_PointerSize\ ==\ AAXPointer\_64bit)}}
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{a00749_ae1e5b0cf8d8c7a301e13772a57a3d2fd}{AAX\_Atomic\_CompareAndExchange\_64}}(*(uint64\_t*)(\textcolor{keywordtype}{void}*)\&ioValue,\ (uint64\_t)inCompareValue,\ (uint64\_t)inExchangeValue);}
\DoxyCodeLine{00091\ \textcolor{preprocessor}{\#elif\ (AAX\_PointerSize\ ==\ AAXPointer\_32bit)}}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{a00749_a74a2bdb895976193bdfe4cd2fe31e21e}{AAX\_Atomic\_CompareAndExchange\_32}}(*(uint32\_t*)(\textcolor{keywordtype}{void}*)\&ioValue,\ (uint32\_t)inCompareValue,\ (uint32\_t)inExchangeValue);}
\DoxyCodeLine{00093\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00094\ \textcolor{preprocessor}{\#error\ Unsupported\ pointer\ size}}
\DoxyCodeLine{00095\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00096\ \}}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00099\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>\ TPointer*\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}\ \mbox{\hyperlink{a00749_ace950fb6e426fd95d69da49462dfb878}{AAX\_Atomic\_Load\_Pointer}}(TPointer\ \textcolor{keyword}{const}\ *\ \textcolor{keyword}{const}\ \textcolor{keyword}{volatile}\ *\ inValue);}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \textcolor{comment}{//TODO:\ Update\ all\ atomic\ function\ implementatons\ with\ proper\ acquire/release\ semantics}}
\DoxyCodeLine{00104\ }
\DoxyCodeLine{00105\ }
\DoxyCodeLine{00106\ \textcolor{comment}{//\ GCC/LLVM}}
\DoxyCodeLine{00107\ \textcolor{preprocessor}{\#if\ defined(\_\_GNUC\_\_)}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \textcolor{comment}{//\ These\ intrinsics\ require\ GCC\ 4.2\ or\ later}}
\DoxyCodeLine{00110\ \textcolor{preprocessor}{\#if\ (\_\_GNUC\_\_\ >\ 4\ ||\ (\_\_GNUC\_\_\ ==\ 4\ \&\&\ \_\_GNUC\_MINOR\_\_\ >=\ 2))}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00112\ \textcolor{keyword}{inline}\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}}
\DoxyCodeLine{00113\ \mbox{\hyperlink{a00749_a56633d7039fae1d31c8984f9baafa17e}{AAX\_Atomic\_IncThenGet\_32}}(uint32\_t\&\ ioData)}
\DoxyCodeLine{00114\ \{}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_add\_and\_fetch(\&ioData,\ 1);}
\DoxyCodeLine{00116\ \}}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ \textcolor{keyword}{inline}\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}}
\DoxyCodeLine{00119\ \mbox{\hyperlink{a00749_adb8e12a71f90de1328a4fde6dd22fc41}{AAX\_Atomic\_DecThenGet\_32}}(uint32\_t\&\ ioData)}
\DoxyCodeLine{00120\ \{}
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_sub\_and\_fetch(\&ioData,\ 1);}
\DoxyCodeLine{00122\ \}}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00124\ \textcolor{keyword}{inline}\ uint32\_t}
\DoxyCodeLine{00125\ \mbox{\hyperlink{a00749_a44eb82707be40dd559db9051317c10d0}{AAX\_Atomic\_Exchange\_32}}(}
\DoxyCodeLine{00126\ \ \ \ \ \textcolor{keyword}{volatile}\ uint32\_t\&\ ioValue,}
\DoxyCodeLine{00127\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00128\ \{}
\DoxyCodeLine{00129\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_lock\_test\_and\_set(\&ioValue,\ inExchangeValue);}
\DoxyCodeLine{00130\ \}}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \textcolor{keyword}{inline}\ uint64\_t}
\DoxyCodeLine{00133\ \mbox{\hyperlink{a00749_a0a683337ef8627f1e2b01e69d5f11cb0}{AAX\_Atomic\_Exchange\_64}}(}
\DoxyCodeLine{00134\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ ioValue,}
\DoxyCodeLine{00135\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00136\ \{}
\DoxyCodeLine{00137\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_lock\_test\_and\_set(\&ioValue,\ inExchangeValue);}
\DoxyCodeLine{00138\ \}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}}
\DoxyCodeLine{00141\ \mbox{\hyperlink{a00749_a74a2bdb895976193bdfe4cd2fe31e21e}{AAX\_Atomic\_CompareAndExchange\_32}}(}
\DoxyCodeLine{00142\ \ \ \ \ \textcolor{keyword}{volatile}\ uint32\_t\ \&\ ioValue,}
\DoxyCodeLine{00143\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00144\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00145\ \{}
\DoxyCodeLine{00146\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_bool\_compare\_and\_swap(\&ioValue,\ inCompareValue,\ inExchangeValue);}
\DoxyCodeLine{00147\ \}}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}}
\DoxyCodeLine{00150\ \mbox{\hyperlink{a00749_ae1e5b0cf8d8c7a301e13772a57a3d2fd}{AAX\_Atomic\_CompareAndExchange\_64}}(}
\DoxyCodeLine{00151\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ \ ioValue,}
\DoxyCodeLine{00152\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00153\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00154\ \{}
\DoxyCodeLine{00155\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_sync\_bool\_compare\_and\_swap(\&ioValue,\ inCompareValue,\ inExchangeValue);}
\DoxyCodeLine{00156\ \}}
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00158\ \textcolor{comment}{//TODO:\ Add\ GCC\ version\ check\ and\ alternative\ implementations\ for\ GCC\ versions\ that\ do\ not\ support\ \_\_atomic\_load}}
\DoxyCodeLine{00159\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00160\ \textcolor{keyword}{inline}\ TPointer*}
\DoxyCodeLine{00161\ \mbox{\hyperlink{a00749_ace950fb6e426fd95d69da49462dfb878}{AAX\_Atomic\_Load\_Pointer}}(TPointer\ \textcolor{keyword}{const}\ *\ \textcolor{keyword}{const}\ \textcolor{keyword}{volatile}\ *\ inValue)}
\DoxyCodeLine{00162\ \{}
\DoxyCodeLine{00163\ \ \ \ \ TPointer*\ value;}
\DoxyCodeLine{00164\ \ \ \ \ \_\_atomic\_load(\textcolor{keyword}{const\_cast<}TPointer\ *\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(inValue),\ \&(value),\ \_\_ATOMIC\_ACQUIRE);}
\DoxyCodeLine{00165\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00166\ \}}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//\ (\_\_GNUC\_\_\ >\ 4\ ||\ (\_\_GNUC\_\_\ ==\ 4\ \&\&\ \_\_GNUC\_MINOR\_\_\ >=\ 2))}}
\DoxyCodeLine{00169\ \textcolor{preprocessor}{\#error\ This\ file\ requires\ GCC\ 4.2\ or\ later}}
\DoxyCodeLine{00170\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ (\_\_GNUC\_\_\ >\ 4\ ||\ (\_\_GNUC\_\_\ ==\ 4\ \&\&\ \_\_GNUC\_MINOR\_\_\ >=\ 2))}}
\DoxyCodeLine{00171\ \textcolor{comment}{//\ End\ GCC/LLVM}}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00173\ }
\DoxyCodeLine{00174\ }
\DoxyCodeLine{00175\ }
\DoxyCodeLine{00176\ }
\DoxyCodeLine{00177\ \textcolor{comment}{//\ Visual\ C}}
\DoxyCodeLine{00178\ \textcolor{preprocessor}{\#elif\ defined(\_MSC\_VER)}}
\DoxyCodeLine{00179\ }
\DoxyCodeLine{00180\ \textcolor{preprocessor}{\#ifndef\ \_\_INTRIN\_H\_}}
\DoxyCodeLine{00181\ \textcolor{preprocessor}{\#include\ <intrin.h>}}
\DoxyCodeLine{00182\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00183\ }
\DoxyCodeLine{00184\ \textcolor{preprocessor}{\#pragma\ intrinsic(\ \ \_InterlockedIncrement,\ \(\backslash\)}}
\DoxyCodeLine{00185\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_InterlockedDecrement,\ \(\backslash\)}}
\DoxyCodeLine{00186\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_InterlockedExchange,\ \(\backslash\)}}
\DoxyCodeLine{00187\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_InterlockedCompareExchange,\ \(\backslash\)}}
\DoxyCodeLine{00188\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_InterlockedCompareExchange64)}}
\DoxyCodeLine{00189\ }
\DoxyCodeLine{00190\ \textcolor{keyword}{inline}\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}}
\DoxyCodeLine{00191\ \mbox{\hyperlink{a00749_a56633d7039fae1d31c8984f9baafa17e}{AAX\_Atomic\_IncThenGet\_32}}(\textcolor{keyword}{register}\ uint32\_t\&\ ioData)}
\DoxyCodeLine{00192\ \{}
\DoxyCodeLine{00193\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(\_InterlockedIncrement((\textcolor{keyword}{volatile}\ \textcolor{keywordtype}{long}*)\&ioData));}
\DoxyCodeLine{00194\ \}}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00196\ \textcolor{keyword}{inline}\ uint32\_t\ \mbox{\hyperlink{a00542_aaa22112139aa627574b1ef562f579d43}{AAX\_CALLBACK}}}
\DoxyCodeLine{00197\ \mbox{\hyperlink{a00749_adb8e12a71f90de1328a4fde6dd22fc41}{AAX\_Atomic\_DecThenGet\_32}}(\textcolor{keyword}{register}\ uint32\_t\&\ ioData)}
\DoxyCodeLine{00198\ \{}
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(\_InterlockedDecrement((\textcolor{keyword}{volatile}\ \textcolor{keywordtype}{long}*)\&ioData));}
\DoxyCodeLine{00200\ \}}
\DoxyCodeLine{00201\ }
\DoxyCodeLine{00202\ \textcolor{keyword}{inline}\ uint32\_t}
\DoxyCodeLine{00203\ \mbox{\hyperlink{a00749_a44eb82707be40dd559db9051317c10d0}{AAX\_Atomic\_Exchange\_32}}(}
\DoxyCodeLine{00204\ \ \ \ \ \textcolor{keyword}{volatile}\ uint32\_t\&\ ioDestination,}
\DoxyCodeLine{00205\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00206\ \{}
\DoxyCodeLine{00207\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(\_InterlockedExchange((\textcolor{keyword}{volatile}\ \textcolor{keywordtype}{long}*)\&ioDestination,\ (\textcolor{keywordtype}{long})inExchangeValue));}
\DoxyCodeLine{00208\ \}}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00210\ \textcolor{preprocessor}{\#if\ (AAX\_PointerSize\ ==\ AAXPointer\_64bit)}}
\DoxyCodeLine{00211\ }
\DoxyCodeLine{00212\ \textcolor{preprocessor}{\#pragma\ intrinsic(\ \ \_InterlockedExchange64,\ \(\backslash\)}}
\DoxyCodeLine{00213\ \textcolor{preprocessor}{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_InterlockedOr64)}}
\DoxyCodeLine{00214\ }
\DoxyCodeLine{00215\ \textcolor{keyword}{inline}\ uint64\_t}
\DoxyCodeLine{00216\ \mbox{\hyperlink{a00749_a0a683337ef8627f1e2b01e69d5f11cb0}{AAX\_Atomic\_Exchange\_64}}(}
\DoxyCodeLine{00217\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ ioValue,}
\DoxyCodeLine{00218\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00219\ \{}
\DoxyCodeLine{00220\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint64\_t\textcolor{keyword}{>}(\_InterlockedExchange64((\textcolor{keyword}{volatile}\ \_\_int64*)\&ioValue,\ (\_\_int64)inExchangeValue));}
\DoxyCodeLine{00221\ \}}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00224\ \textcolor{keyword}{inline}\ TPointer*}
\DoxyCodeLine{00225\ \mbox{\hyperlink{a00749_ace950fb6e426fd95d69da49462dfb878}{AAX\_Atomic\_Load\_Pointer}}(TPointer\ \textcolor{keyword}{const}\ *\ \textcolor{keyword}{const}\ \textcolor{keyword}{volatile}\ *\ inValue)}
\DoxyCodeLine{00226\ \{}
\DoxyCodeLine{00227\ \textcolor{comment}{//\ Itanium\ supports\ acquire\ semantics}}
\DoxyCodeLine{00228\ \textcolor{preprocessor}{\#if\ (\_M\_IA64)}}
\DoxyCodeLine{00229\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{reinterpret\_cast<}TPointer*\textcolor{keyword}{>}(\_InterlockedOr64\_acq(\textcolor{keyword}{const\_cast<}\_\_int64\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(\textcolor{keyword}{reinterpret\_cast<}\textcolor{keyword}{const\ }\_\_int64\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(inValue)),\ 0x0000000000000000));}
\DoxyCodeLine{00230\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00231\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{reinterpret\_cast<}TPointer*\textcolor{keyword}{>}(\_InterlockedOr64(\textcolor{keyword}{const\_cast<}\_\_int64\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(\textcolor{keyword}{reinterpret\_cast<}\textcolor{keyword}{const\ }\_\_int64\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(inValue)),\ 0x0000000000000000));}
\DoxyCodeLine{00232\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00233\ \}}
\DoxyCodeLine{00234\ }
\DoxyCodeLine{00235\ \textcolor{preprocessor}{\#elif\ (AAX\_PointerSize\ ==\ AAXPointer\_32bit)}}
\DoxyCodeLine{00236\ }
\DoxyCodeLine{00237\ \textcolor{preprocessor}{\#pragma\ intrinsic(\ \ \_InterlockedOr\ )}}
\DoxyCodeLine{00238\ }
\DoxyCodeLine{00239\ \textcolor{comment}{//\ \_InterlockedExchange64\ is\ not\ available\ on\ 32-\/bit\ Pentium\ in\ Visual\ C}}
\DoxyCodeLine{00240\ \textcolor{keyword}{inline}\ uint64\_t}
\DoxyCodeLine{00241\ \mbox{\hyperlink{a00749_a0a683337ef8627f1e2b01e69d5f11cb0}{AAX\_Atomic\_Exchange\_64}}(}
\DoxyCodeLine{00242\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ ioValue,}
\DoxyCodeLine{00243\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00244\ \{}
\DoxyCodeLine{00245\ \ \ \ \ \textcolor{keywordflow}{for}(;;)}
\DoxyCodeLine{00246\ \ \ \ \ \{}
\DoxyCodeLine{00247\ \ \ \ \ \ \ \ \ uint64\_t\ \ \ \ result\ =\ ioValue;}
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{a00749_ae1e5b0cf8d8c7a301e13772a57a3d2fd}{AAX\_Atomic\_CompareAndExchange\_64}}(ioValue,\ result,\ inExchangeValue))}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ result;}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00252\ \ \ \ \ \}}
\DoxyCodeLine{00253\ \ \ \ \ }
\DoxyCodeLine{00254\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;\ \ \ \textcolor{comment}{//\ will\ never\ get\ here}}
\DoxyCodeLine{00255\ \}}
\DoxyCodeLine{00256\ }
\DoxyCodeLine{00257\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ TPo\textcolor{keywordtype}{int}er>}
\DoxyCodeLine{00258\ \textcolor{keyword}{inline}\ TPointer*}
\DoxyCodeLine{00259\ \mbox{\hyperlink{a00749_ace950fb6e426fd95d69da49462dfb878}{AAX\_Atomic\_Load\_Pointer}}(TPointer\ \textcolor{keyword}{const}\ *\ \textcolor{keyword}{const}\ \textcolor{keyword}{volatile}\ *\ inValue)}
\DoxyCodeLine{00260\ \{}
\DoxyCodeLine{00261\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{reinterpret\_cast<}TPointer*\textcolor{keyword}{>}(\_InterlockedOr(\textcolor{keyword}{const\_cast<}\textcolor{keywordtype}{long}\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(\textcolor{keyword}{reinterpret\_cast<}\textcolor{keyword}{const\ }\textcolor{keywordtype}{long}\ \textcolor{keyword}{volatile\ }*\textcolor{keyword}{>}(inValue)),\ 0x00000000));}
\DoxyCodeLine{00262\ \}}
\DoxyCodeLine{00263\ }
\DoxyCodeLine{00264\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00265\ }
\DoxyCodeLine{00266\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}}
\DoxyCodeLine{00267\ \mbox{\hyperlink{a00749_a74a2bdb895976193bdfe4cd2fe31e21e}{AAX\_Atomic\_CompareAndExchange\_32}}(}
\DoxyCodeLine{00268\ \ \ \ \ uint32\_t\ \textcolor{keyword}{volatile}\ \&\ ioValue,}
\DoxyCodeLine{00269\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00270\ \ \ \ \ uint32\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00271\ \{}
\DoxyCodeLine{00272\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint32\_t\textcolor{keyword}{>}(\_InterlockedCompareExchange((\textcolor{keyword}{volatile}\ \textcolor{keywordtype}{long}*)\&ioValue,\ (\textcolor{keywordtype}{long})inExchangeValue,\ (\textcolor{keywordtype}{long})inCompareValue))\ ==\ inCompareValue;}
\DoxyCodeLine{00273\ \}}
\DoxyCodeLine{00274\ }
\DoxyCodeLine{00275\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{bool}}
\DoxyCodeLine{00276\ \mbox{\hyperlink{a00749_ae1e5b0cf8d8c7a301e13772a57a3d2fd}{AAX\_Atomic\_CompareAndExchange\_64}}(}
\DoxyCodeLine{00277\ \ \ \ \ \textcolor{keyword}{volatile}\ uint64\_t\&\ \ ioValue,}
\DoxyCodeLine{00278\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inCompareValue,}
\DoxyCodeLine{00279\ \ \ \ \ uint64\_t\ \ \ \ \ \ \ \ \ \ \ \ inExchangeValue)}
\DoxyCodeLine{00280\ \{}
\DoxyCodeLine{00281\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}uint64\_t\textcolor{keyword}{>}(\_InterlockedCompareExchange64((\textcolor{keyword}{volatile}\ \_\_int64*)\&ioValue,\ (\_\_int64)inExchangeValue,\ (\_\_int64)inCompareValue))\ ==\ inCompareValue;}
\DoxyCodeLine{00282\ \}}
\DoxyCodeLine{00283\ }
\DoxyCodeLine{00284\ \textcolor{comment}{//\ End\ Visual\ C}}
\DoxyCodeLine{00285\ }
\DoxyCodeLine{00286\ }
\DoxyCodeLine{00287\ }
\DoxyCodeLine{00288\ }
\DoxyCodeLine{00289\ }
\DoxyCodeLine{00290\ \textcolor{preprocessor}{\#else\ }\textcolor{comment}{//\ Not\ Visual\ C\ or\ GCC/LLVM}}
\DoxyCodeLine{00291\ \textcolor{preprocessor}{\#error\ Provide\ an\ atomic\ operation\ implementation\ for\ this\ compiler}}
\DoxyCodeLine{00292\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ Compiler\ version\ check}}
\DoxyCodeLine{00293\ }
\DoxyCodeLine{00294\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \#ifndef\ AAX\_ATOMIC\_H\_}}

\end{DoxyCode}
