summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-09 15:36:38 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-09 15:36:38 +0100
commit8990f74eb66570c82bb67f98bdf8f514143c8650 (patch)
tree5f3813a85aec8981813617beee2075f75589abe6
parent43cc8f98f400f063772ff680e5798f664f9acb41 (diff)
downloadabrt-8990f74eb66570c82bb67f98bdf8f514143c8650.tar.gz
abrt-8990f74eb66570c82bb67f98bdf8f514143c8650.tar.xz
abrt-8990f74eb66570c82bb67f98bdf8f514143c8650.zip
fix big-endian build problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--lib/Plugins/Python_hash.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Plugins/Python_hash.cpp b/lib/Plugins/Python_hash.cpp
index ae246b38..36ddacdc 100644
--- a/lib/Plugins/Python_hash.cpp
+++ b/lib/Plugins/Python_hash.cpp
@@ -14,6 +14,7 @@
*/
#include "abrtlib.h"
#include "Python_hash.h"
+#include <byteswap.h>
#if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
# define MD5_BIG_ENDIAN 1
@@ -28,6 +29,16 @@
# error "Can't determine endianness"
#endif
+/* SWAP_LEnn means "convert CPU<->little_endian if needed (by swapping bytes)" */
+#if MD5_BIG_ENDIAN
+# define SWAP_BE32(x) (x)
+# define SWAP_LE32(x) bswap_32(x)
+#else
+# define SWAP_BE32(x) bswap_32(x)
+# define SWAP_LE32(x) (x)
+#endif
+
+
/* 0: fastest, 3: smallest */
#define MD5_SIZE_VS_SPEED 3
@@ -123,11 +134,7 @@ static void md5_hash_block(const void *buffer, md5_ctx_t *ctx)
uint32_t temp;
for (i = 0; i < 16; i++) {
-#if MD5_BIG_ENDIAN
- cwp[i] = bswap_32(words[i]);
-#else
- cwp[i] = words[i];
-#endif
+ cwp[i] = SWAP_LE32(words[i]);
}
words += 16;