From 0f37987c0df7fcc19df8d1f68bdab0e72bae6301 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 30 Sep 2004 18:49:03 +0000 Subject: [PATCH] added endian macros git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3681 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/util.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/util.h b/Source/util.h index 970345c3..6e678f61 100644 --- a/Source/util.h +++ b/Source/util.h @@ -31,6 +31,17 @@ int WCStrLen(const WCHAR* szwStr); size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm); +#ifndef __BIG_ENDIAN__ +# define FIX_ENDIAN_INT32_INPLACE(x) (x) +#else +# define FIX_ENDIAN_INT32_INPLACE(x) ((x) = SWAP_ENDIAN_INT32(x)) +#endif +#define SWAP_ENDIAN_INT32(x) ( \ + (((x)&0xFF000000) >> 24) | \ + (((x)&0x00FF0000) >> 8) | \ + (((x)&0x0000FF00) << 8) | \ + (((x)&0x000000FF) << 24) ) + #ifndef _WIN32 char *CharPrev(const char *s, const char *p); char *CharNext(const char *s);