aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-14 03:33:33 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-14 03:33:33 +0000
commit4a2e4635253e615678cea6f2c253485d26dde73a (patch)
treee382ce1e89670e5079d30fb03b8e1a455fdefee1 /coreutils
parent0f50bca9aaae78fd23a2ab7890e81c88473a4a25 (diff)
downloadbusybox-4a2e4635253e615678cea6f2c253485d26dde73a.tar.gz
Handle endian-ness. Patch from Paul J.Y. Lahaie <pjlahaie@linuxcare.com>
-Erik
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/md5sum.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index ac3462334..a9bbdef36 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -181,7 +181,14 @@ extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
//--------end of md5.h
//----------------------------------------------------------------------------
-#define SWAP(n) (n)
+/* Handle endian-ness */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define SWAP(n) (n)
+#else
+ #define SWAP(n) ((n << 24) | ((n&65280)<<8) | ((n&16711680)>>8) | (n>>24))
+#endif
+
+
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. (RFC 1321, 3.1: Step 1) */