summary refs log tree commit diff
path: root/src/liboutils/include/machine/endian.h
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-07-31 16:09:53 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-07-31 16:09:53 +0200
commit879d51525932a2ba2841744ed302c170b5dc8270 (patch)
tree003d31fb6c5e7e8e1654ef07247215be93dfa960 /src/liboutils/include/machine/endian.h
parent92f91930172eec04f302898d2957e32f1d773348 (diff)
downloadoutils-879d51525932a2ba2841744ed302c170b5dc8270.tar.gz
outils-879d51525932a2ba2841744ed302c170b5dc8270.tar.xz
outils-879d51525932a2ba2841744ed302c170b5dc8270.zip
add liboutils (from OpenBSD, libressl-portable, obase)
Diffstat (limited to 'src/liboutils/include/machine/endian.h')
-rw-r--r--src/liboutils/include/machine/endian.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/liboutils/include/machine/endian.h b/src/liboutils/include/machine/endian.h
new file mode 100644
index 0000000..80b3f9c
--- /dev/null
+++ b/src/liboutils/include/machine/endian.h
@@ -0,0 +1,35 @@
+#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
+#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
+
+#if defined(__WIN32)
+
+#define LITTLE_ENDIAN  1234
+#define BIG_ENDIAN 4321
+#define PDP_ENDIAN	3412
+
+/*
+ * Use GCC and Visual Studio compiler defines to determine endian.
+ */
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define BYTE_ORDER LITTLE_ENDIAN
+#else
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+
+#elif defined(__linux__)
+#include <endian.h>
+
+#elif defined(__sun) || defined(_AIX) || defined(__hpux)
+#include <sys/types.h>
+#include <arpa/nameser_compat.h>
+
+#elif defined(__sgi)
+#include <standards.h>
+#include <sys/endian.h>
+
+#else
+#include_next <machine/endian.h>
+
+#endif
+
+#endif