From b8c85c9f39ab2a9448a11715c2c93647f2a4b8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Tue, 24 Sep 2013 12:44:13 +0200 Subject: [PATCH] fix for big endians Include the <endian.h> header and set the WORDS_BIGENDIAN define according to BYTE_ORDER. --- modp_b64.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modp_b64.c b/modp_b64.c index 9215b45..dd1164c 100644 --- a/modp_b64.c +++ b/modp_b64.c @@ -41,14 +41,19 @@ * </PRE> */ +#include <endian.h> + /* public header */ #include "modp_b64.h" -/* if on motoral, sun, ibm; uncomment this */ -/* #define WORDS_BIGENDIAN 1 */ -/* else for Intel, Amd; uncomment this */ -/* #undef WORDS_BIGENDIAN */ +#if BYTE_ORDER == BIG_ENDIAN +/* if on motoral, sun, ibm */ +#define WORDS_BIGENDIAN 1 +#else +/* else for Intel, Amd */ +#undef WORDS_BIGENDIAN +#endif #include "modp_b64_data.h" -- 1.8.1.4