\hypertarget{a00410_source}{}\doxysection{AAX\+\_\+\+Endian\+Swap.\+h}
\label{a00410_source}\index{AAX\_EndianSwap.h@{AAX\_EndianSwap.h}}
\mbox{\hyperlink{a00410}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ Copyright\ 2013-\/2015,\ 2023-\/2024\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ This\ file\ is\ part\ of\ the\ Avid\ AAX\ SDK.}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ The\ AAX\ SDK\ is\ subject\ to\ commercial\ or\ open-\/source\ licensing.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ By\ using\ the\ AAX\ SDK,\ you\ agree\ to\ the\ terms\ of\ both\ the\ Avid\ AAX\ SDK\ License}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ \ Agreement\ and\ Avid\ Privacy\ Policy.}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ AAX\ SDK\ License:\ https://developer.avid.com/aax}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ Privacy\ Policy:\ https://www.avid.com/legal/privacy-\/policy-\/statement}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ \ Or:\ You\ may\ also\ use\ this\ code\ under\ the\ terms\ of\ the\ GPL\ v3\ (see}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ \ www.gnu.org/licenses).}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ \ THE\ AAX\ SDK\ IS\ PROVIDED\ "{}AS\ IS"{}\ WITHOUT\ ANY\ WARRANTY,\ AND\ ALL\ WARRANTIES,\ WHETHER}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ \ EXPRESSED\ OR\ IMPLIED,\ INCLUDING\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ PURPOSE,\ ARE}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ \ DISCLAIMED.}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00024\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00032\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#ifndef\ ENDIANSWAP\_H}}
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#define\ ENDIANSWAP\_H}}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{comment}{//\ Standard\ headers}}
\DoxyCodeLine{00041\ \textcolor{preprocessor}{\#include\ <algorithm>}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00044\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00047\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00410_a5caa5e68dec3f028697b64ad04f0cb5c}{AAX\_EndianSwap}}(T\ theData);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00051\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00054\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00410_a7387790d73eed6c54af682c7afd9e463}{AAX\_BigEndianNativeSwap}}(T\ theData);}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(T*\ theDataP);}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00060\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ T\ \mbox{\hyperlink{a00410_a49f57c502ff278b26260b1744da99633}{AAX\_LittleEndianNativeSwap}}(T\ theData);}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ }
\DoxyCodeLine{00065\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00069\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_ae9e72785a26249cd3e3c05baf8c9ce70}{AAX\_BigEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00072\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_a4d8bcdfb048c8124f1f2886537e65678}{AAX\_LittleEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI);}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \textcolor{comment}{//}}
\DoxyCodeLine{00076\ \textcolor{comment}{//\ Implementations}}
\DoxyCodeLine{00077\ \textcolor{comment}{//}}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00079\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00080\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00081\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{00082\ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00083\ \{}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{char}\ *begin,\ *end;}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \ \ \ \ begin\ =\ \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(theDataP);}
\DoxyCodeLine{00087\ \ \ \ \ end\ =\ begin\ +\ \textcolor{keyword}{sizeof}(\ T\ );}
\DoxyCodeLine{00088\ \ \ \ \ std::reverse(\ begin,\ end\ );}
\DoxyCodeLine{00089\ \}}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ }
\DoxyCodeLine{00092\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00093\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00094\ T\ \mbox{\hyperlink{a00410_a5caa5e68dec3f028697b64ad04f0cb5c}{AAX\_EndianSwap}}(T\ theData)}
\DoxyCodeLine{00095\ \{}
\DoxyCodeLine{00096\ \ \ \ \ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(\&theData);}
\DoxyCodeLine{00097\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00098\ \}}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>}
\DoxyCodeLine{00102\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00103\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00104\ \{}
\DoxyCodeLine{00105\ \textcolor{preprocessor}{\#if\ (!defined\ \_\_BIG\_ENDIAN\_\_)\ ||\ (0\ ==\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00106\ \ \ \ \ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(theDataP);}
\DoxyCodeLine{00107\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00108\ \}}
\DoxyCodeLine{00109\ }
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00112\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00113\ T\ \mbox{\hyperlink{a00410_a7387790d73eed6c54af682c7afd9e463}{AAX\_BigEndianNativeSwap}}(T\ theData)}
\DoxyCodeLine{00114\ \{}
\DoxyCodeLine{00115\ \ \ \ \ \mbox{\hyperlink{a00410_a2aa4dc892c77aa0ed29e84a5f29c9538}{AAX\_BigEndianNativeSwapInPlace}}(\&theData);}
\DoxyCodeLine{00116\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00117\ \}}
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00121\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00122\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(T*\ theDataP)}
\DoxyCodeLine{00123\ \{}
\DoxyCodeLine{00124\ \textcolor{preprocessor}{\#if\ (defined\ \_\_BIG\_ENDIAN\_\_)\ \&\&\ (0\ !=\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00125\ \ \ \ \ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(theDataP);}
\DoxyCodeLine{00126\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00127\ \}}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ T>\ \ \ }
\DoxyCodeLine{00131\ \textcolor{keyword}{inline}\ }
\DoxyCodeLine{00132\ T\ \mbox{\hyperlink{a00410_a49f57c502ff278b26260b1744da99633}{AAX\_LittleEndianNativeSwap}}(T\ theData)}
\DoxyCodeLine{00133\ \{}
\DoxyCodeLine{00134\ \ \ \ \ \mbox{\hyperlink{a00410_af4164bdfb3807edcd582e0289a6ed59a}{AAX\_LittleEndianNativeSwapInPlace}}(\&theData);}
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordflow}{return}\ theData;}
\DoxyCodeLine{00136\ \}}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00140\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00141\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00142\ \{}
\DoxyCodeLine{00143\ \ \ \ \ \textcolor{keywordflow}{for}(Iter\ i\ =\ beginI;\ i\ !=\ endI;\ ++i)}
\DoxyCodeLine{00144\ \ \ \ \ \{}
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ WARNING\ :\ Will\ this\ give\ a\ compile\ error\ if\ a\ use\ mistakenly\ uses\ it\ on\ a\ const\ sequence?}}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{a00410_a121ee6a20eb996039b0f187db0a2cc8e}{AAX\_EndianSwapInPlace}}(\&(*i));}
\DoxyCodeLine{00147\ \ \ \ \ \};}
\DoxyCodeLine{00148\ \}}
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00152\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00153\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_ae9e72785a26249cd3e3c05baf8c9ce70}{AAX\_BigEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00154\ \{}
\DoxyCodeLine{00155\ \textcolor{preprocessor}{\#if\ (!defined\ \_\_BIG\_ENDIAN\_\_)\ ||\ (0\ ==\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00156\ \ \ \ \ \mbox{\hyperlink{a00410_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(beginI,\ endI);}
\DoxyCodeLine{00157\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00158\ \}}
\DoxyCodeLine{00159\ }
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00161\ \textcolor{keyword}{template}<\textcolor{keyword}{class}\ Iter>\ \ \ \ }
\DoxyCodeLine{00162\ \textcolor{keyword}{inline}}
\DoxyCodeLine{00163\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00410_a4d8bcdfb048c8124f1f2886537e65678}{AAX\_LittleEndianNativeSwapSequenceInPlace}}(Iter\ beginI,\ Iter\ endI)}
\DoxyCodeLine{00164\ \{}
\DoxyCodeLine{00165\ \textcolor{preprocessor}{\#if\ (defined\ \_\_BIG\_ENDIAN\_\_)\ \&\&\ (0\ !=\ \_\_BIG\_ENDIAN\_\_)}}
\DoxyCodeLine{00166\ \ \ \ \ \mbox{\hyperlink{a00410_ae58f8ce3c8247e07d49e17c011ec5366}{AAX\_EndianSwapSequenceInPlace}}(beginI,\ endI);}
\DoxyCodeLine{00167\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00168\ \}}
\DoxyCodeLine{00169\ }
\DoxyCodeLine{00170\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
