2014-11-19 14:43:07 +01:00
|
|
|
/*
|
|
|
|
* Public domain
|
|
|
|
* machine/endian.h compatibility shim
|
|
|
|
*/
|
|
|
|
|
2014-07-20 20:59:03 +02:00
|
|
|
#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
|
|
|
|
#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
|
2014-07-10 13:21:51 +02:00
|
|
|
|
2014-11-05 13:52:00 +01:00
|
|
|
#if defined(_WIN32)
|
2014-07-20 20:59:03 +02:00
|
|
|
|
|
|
|
#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
|
2014-07-10 13:21:51 +02:00
|
|
|
#else
|
2014-07-20 20:59:03 +02:00
|
|
|
#define BYTE_ORDER BIG_ENDIAN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(__linux__)
|
|
|
|
#include <endian.h>
|
|
|
|
|
2014-07-30 14:07:48 +02:00
|
|
|
#elif defined(__sun) || defined(_AIX) || defined(__hpux)
|
2014-07-25 20:58:53 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <arpa/nameser_compat.h>
|
|
|
|
|
|
|
|
#elif defined(__sgi)
|
|
|
|
#include <standards.h>
|
|
|
|
#include <sys/endian.h>
|
|
|
|
|
2014-07-10 13:21:51 +02:00
|
|
|
#else
|
|
|
|
#include_next <machine/endian.h>
|
2014-07-20 20:59:03 +02:00
|
|
|
|
2014-07-10 13:21:51 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|