\hypertarget{_endian_8h}{\section{Core/\-Utils/\-Legacy/\-Endian.h File Reference}
\label{_endian_8h}\index{Core/\-Utils/\-Legacy/\-Endian.\-h@{Core/\-Utils/\-Legacy/\-Endian.\-h}}
}


Detect host endianness and provide tools to swap bytes if necessary.  


{\ttfamily \#include $<$sci\-\_\-defs/config\-\_\-defs.\-h$>$}\\*
{\ttfamily \#include $<$string$>$}\\*
{\ttfamily \#include $<$Core/\-Utils/\-Legacy/share.\-h$>$}\\*
\subsection*{Namespaces}
\begin{DoxyCompactItemize}
\item 
\hyperlink{namespace_s_c_i_run}{S\-C\-I\-Run}
\begin{DoxyCompactList}\small\item\em S\-T\-L datatypes needed. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{_endian_8h_afe16a3d5eb7b99d0e4146707a6116269}{S\-W\-A\-P\-\_\-2}(u2)
\item 
\#define \hyperlink{_endian_8h_a1ddc6df10597600bbcbba411e05e2900}{S\-W\-A\-P\-\_\-4}(u4)
\item 
\#define \hyperlink{_endian_8h_ab847c4b9f321886b15102aa323b294f1}{S\-W\-A\-P\-\_\-8}(u8)
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{namespace_s_c_i_run_a5b203c0b34977af8ff3ab54afec4570e}{swapbytes} (bool \&)
\item 
void \hyperlink{namespace_s_c_i_run_a0278ea838339d2828b5d9f27e4b418b8}{swapbytes} (int8\-\_\-t \&)
\item 
void \hyperlink{namespace_s_c_i_run_ac4b3e29fbdaa380241aadf055c5f1114}{swapbytes} (uint8\-\_\-t \&)
\item 
void \hyperlink{namespace_s_c_i_run_a182048511936ff99516d6a911ec78727}{swapbytes} (int16\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_a3b6e3708b30183cffeea7bbf5bd72c48}{swapbytes} (uint16\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_aac16e081b0ace8425b17a78be4991fa3}{swapbytes} (int32\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_a4ae651cabc5f6642ca2f91e6e8e40ad6}{swapbytes} (uint32\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_a2d98a3698e045cf5a88d2b4098214921}{swapbytes} (int64\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_afb3555c76c62ce95272caa3b6ac4f73d}{swapbytes} (uint64\-\_\-t \&i)
\item 
void \hyperlink{namespace_s_c_i_run_ae8925a8310134f16542303e72de2f860}{swapbytes} (float \&i)
\item 
void \hyperlink{namespace_s_c_i_run_a0a3ad811c3ee94a48272e107c00540de}{swapbytes} (double \&i)
\item 
bool \hyperlink{namespace_s_c_i_run_aa4ada8fb43272a2450d9c48c928a58da}{is\-Big\-Endian} ()
\item 
bool \hyperlink{namespace_s_c_i_run_adae269b5cace61ce2527d1e4b84b5065}{is\-Little\-Endian} ()
\item 
std\-::string \hyperlink{namespace_s_c_i_run_ad5d22666346413cf4bdb0d9183fc9d8a}{endianness} ()
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Detect host endianness and provide tools to swap bytes if necessary. \begin{DoxyAuthor}{Author}
Kurt Zimmerman Department of Computer Science University of Utah 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
January 2001 
\end{DoxyDate}


\subsection{Macro Definition Documentation}
\hypertarget{_endian_8h_afe16a3d5eb7b99d0e4146707a6116269}{\index{Endian.\-h@{Endian.\-h}!S\-W\-A\-P\-\_\-2@{S\-W\-A\-P\-\_\-2}}
\index{S\-W\-A\-P\-\_\-2@{S\-W\-A\-P\-\_\-2}!Endian.h@{Endian.\-h}}
\subsubsection[{S\-W\-A\-P\-\_\-2}]{\setlength{\rightskip}{0pt plus 5cm}\#define S\-W\-A\-P\-\_\-2(
\begin{DoxyParamCaption}
\item[{}]{u2}
\end{DoxyParamCaption}
)}}\label{_endian_8h_afe16a3d5eb7b99d0e4146707a6116269}
{\bfseries Value\-:}
\begin{DoxyCode}
\textcolor{comment}{/* IronDoc macro to swap two byte quantity */} \(\backslash\)
  \{ \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}* \_p = \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}*\textcolor{keyword}{>}(&(u2)); \(\backslash\)
    unsigned \textcolor{keywordtype}{char} \_c =   *\_p; *\_p = \_p[1]; \_p[1] = \_c; \}
\end{DoxyCode}
\hypertarget{_endian_8h_a1ddc6df10597600bbcbba411e05e2900}{\index{Endian.\-h@{Endian.\-h}!S\-W\-A\-P\-\_\-4@{S\-W\-A\-P\-\_\-4}}
\index{S\-W\-A\-P\-\_\-4@{S\-W\-A\-P\-\_\-4}!Endian.h@{Endian.\-h}}
\subsubsection[{S\-W\-A\-P\-\_\-4}]{\setlength{\rightskip}{0pt plus 5cm}\#define S\-W\-A\-P\-\_\-4(
\begin{DoxyParamCaption}
\item[{}]{u4}
\end{DoxyParamCaption}
)}}\label{_endian_8h_a1ddc6df10597600bbcbba411e05e2900}
{\bfseries Value\-:}
\begin{DoxyCode}
\textcolor{comment}{/* IronDoc macro to swap four byte quantity */} \(\backslash\)
  \{ \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}* \_p = \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}*\textcolor{keyword}{>}(&(u4)); \(\backslash\)
    unsigned \textcolor{keywordtype}{char}  \_c =   *\_p; *\_p = \_p[3]; \_p[3] = \_c; \(\backslash\)
                   \_c = *++\_p; *\_p = \_p[1]; \_p[1] = \_c; \}
\end{DoxyCode}
\hypertarget{_endian_8h_ab847c4b9f321886b15102aa323b294f1}{\index{Endian.\-h@{Endian.\-h}!S\-W\-A\-P\-\_\-8@{S\-W\-A\-P\-\_\-8}}
\index{S\-W\-A\-P\-\_\-8@{S\-W\-A\-P\-\_\-8}!Endian.h@{Endian.\-h}}
\subsubsection[{S\-W\-A\-P\-\_\-8}]{\setlength{\rightskip}{0pt plus 5cm}\#define S\-W\-A\-P\-\_\-8(
\begin{DoxyParamCaption}
\item[{}]{u8}
\end{DoxyParamCaption}
)}}\label{_endian_8h_ab847c4b9f321886b15102aa323b294f1}
{\bfseries Value\-:}
\begin{DoxyCode}
\textcolor{comment}{/* IronDoc macro to swap eight byte quantity */} \(\backslash\)
  \{ \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}* \_p = \textcolor{keyword}{reinterpret\_cast<}\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char}*\textcolor{keyword}{>}(&(u8)); \(\backslash\)
    unsigned \textcolor{keywordtype}{char}  \_c =   *\_p; *\_p = \_p[7]; \_p[7] = \_c; \(\backslash\)
                   \_c = *++\_p; *\_p = \_p[5]; \_p[5] = \_c; \(\backslash\)
                   \_c = *++\_p; *\_p = \_p[3]; \_p[3] = \_c; \(\backslash\)
                   \_c = *++\_p; *\_p = \_p[1]; \_p[1] = \_c; \}
\end{DoxyCode}
