From 8ba400493449f8757627713043ae6e5a8f04ce6d Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 14 May 2010 19:21:30 +0200 Subject: [PATCH] Fixed sha1.c compilation on Linux, due to endianess detection lameness --- sha1.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sha1.c b/sha1.c index a768a7a7..a4f54c9e 100644 --- a/sha1.c +++ b/sha1.c @@ -21,6 +21,8 @@ A million repetitions of "a" #define SHA1HANDSOFF +#include + #include #include #include /* for u_int*_t */ @@ -56,6 +58,14 @@ A million repetitions of "a" #endif /* BSD */ #endif /* BYTE_ORDER */ +#if defined(__BYTE_ORDER) && !defined(BYTE_ORDER) +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define BYTE_ORDER LITTLE_ENDIAN +#else +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif + #if !defined(BYTE_ORDER) || \ (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ BYTE_ORDER != PDP_ENDIAN) @@ -64,7 +74,7 @@ A million repetitions of "a" * which will force your compiles to bomb until you fix * the above macros. */ - error "Undefined or invalid BYTE_ORDER"; +#error "Undefined or invalid BYTE_ORDER" #endif #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) -- 2.45.2