\doxysection{endian.\+h}
\label{endian_8h_source}\index{include/osmocom/core/endian.h@{include/osmocom/core/endian.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{14 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{15 }
\DoxyCodeLine{16 \textcolor{preprocessor}{\#if defined(\_\_FreeBSD\_\_)}}
\DoxyCodeLine{17 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{18 \textcolor{preprocessor}{        \#if BYTE\_ORDER == LITTLE\_ENDIAN}}
\DoxyCodeLine{19 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           1}}
\DoxyCodeLine{20 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              0}}
\DoxyCodeLine{21 \textcolor{preprocessor}{        \#elif BYTE\_ORDER == BIG\_ENDIAN}}
\DoxyCodeLine{22 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           0}}
\DoxyCodeLine{23 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              1}}
\DoxyCodeLine{24 \textcolor{preprocessor}{        \#else}}
\DoxyCodeLine{25 \textcolor{preprocessor}{                \#error "{}Unknown endian"{}}}
\DoxyCodeLine{26 \textcolor{preprocessor}{        \#endif}}
\DoxyCodeLine{27 \textcolor{preprocessor}{\#elif defined(\_\_APPLE\_\_)}}
\DoxyCodeLine{28 \textcolor{preprocessor}{\#include <machine/endian.h>}}
\DoxyCodeLine{29 \textcolor{preprocessor}{        \#if defined(\_\_DARWIN\_LITTLE\_ENDIAN)}}
\DoxyCodeLine{30 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           1}}
\DoxyCodeLine{31 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              0}}
\DoxyCodeLine{32 \textcolor{preprocessor}{        \#elif defined(\_\_DARWIN\_BIG\_ENDIAN)}}
\DoxyCodeLine{33 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           0}}
\DoxyCodeLine{34 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              1}}
\DoxyCodeLine{35 \textcolor{preprocessor}{        \#else}}
\DoxyCodeLine{36 \textcolor{preprocessor}{                \#error "{}Unknown endian"{}}}
\DoxyCodeLine{37 \textcolor{preprocessor}{        \#endif}}
\DoxyCodeLine{38 \textcolor{preprocessor}{\#elif defined(\_\_linux\_\_)}}
\DoxyCodeLine{39 \textcolor{preprocessor}{\#include <endian.h>}}
\DoxyCodeLine{40 \textcolor{preprocessor}{        \#if \_\_BYTE\_ORDER == \_\_LITTLE\_ENDIAN}}
\DoxyCodeLine{41 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           1}}
\DoxyCodeLine{42 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              0}}
\DoxyCodeLine{43 \textcolor{preprocessor}{        \#elif \_\_BYTE\_ORDER == \_\_BIG\_ENDIAN}}
\DoxyCodeLine{44 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           0}}
\DoxyCodeLine{45 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              1}}
\DoxyCodeLine{46 \textcolor{preprocessor}{        \#else}}
\DoxyCodeLine{47 \textcolor{preprocessor}{                \#error "{}Unknown endian"{}}}
\DoxyCodeLine{48 \textcolor{preprocessor}{        \#endif}}
\DoxyCodeLine{49 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{50         \textcolor{comment}{/* let's try to rely on the compiler.  GCC and CLANG/LLVM seem}}
\DoxyCodeLine{51 \textcolor{comment}{         * to support this ... */}}
\DoxyCodeLine{52 \textcolor{preprocessor}{        \#if \_\_BYTE\_ORDER\_\_ == \_\_ORDER\_LITTLE\_ENDIAN\_\_}}
\DoxyCodeLine{53 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           1}}
\DoxyCodeLine{54 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              0}}
\DoxyCodeLine{55 \textcolor{preprocessor}{        \#elif \_\_BYTE\_ORDER\_\_ == \_\_ORDER\_BIG\_ENDIAN\_\_}}
\DoxyCodeLine{56 \textcolor{preprocessor}{                \#define OSMO\_IS\_LITTLE\_ENDIAN           0}}
\DoxyCodeLine{57 \textcolor{preprocessor}{                \#define OSMO\_IS\_BIG\_ENDIAN              1}}
\DoxyCodeLine{58 \textcolor{preprocessor}{        \#else}}
\DoxyCodeLine{59 \textcolor{preprocessor}{                \#error "{}Unknown endian"{}}}
\DoxyCodeLine{60 \textcolor{preprocessor}{        \#endif}}
\DoxyCodeLine{61 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{62 }

\end{DoxyCode}
