From 136ddd7a9bcec800f12520c4a08e642477ddabda Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 20 Jul 2014 13:59:03 -0500 Subject: [PATCH] update guard, add win32 support for endian.h Thanks to Jonas 'Sortie' Termansen for pointing the guard inconsistency out. ok beck@ --- include/machine/endian.h | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/include/machine/endian.h b/include/machine/endian.h index 4d96a6d..302d29e 100644 --- a/include/machine/endian.h +++ b/include/machine/endian.h @@ -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 +#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 + +#elif defined(__sun) #include + #else #include_next -#endif + #endif #endif