update guard, add win32 support for endian.h

Thanks to Jonas 'Sortie' Termansen for pointing the guard inconsistency out.

ok beck@
This commit is contained in:
Brent Cook 2014-07-20 13:59:03 -05:00
parent 9c2c499bf3
commit 136ddd7a9b

View File

@ -1,14 +1,30 @@
#ifndef _COMPAT_BYTE_ORDER_H_
#define _COMPAT_BYTE_ORDER_H_
#ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#define LIBCRYPTOCOMPAT_BYTE_ORDER_H_
#ifdef __linux__
#include <endian.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
#ifdef __sun
#define BYTE_ORDER BIG_ENDIAN
#endif
#elif defined(__linux__)
#include <endian.h>
#elif defined(__sun)
#include <arpa/nameser_compat.h>
#else
#include_next <machine/endian.h>
#endif
#endif
#endif