[BusyBox-cvs] busybox/libbb hash_fd.c,1.3,1.4

Erik Andersen andersen at busybox.net
Thu Jan 29 22:33:30 UTC 2004


Update of /var/cvs/busybox/libbb
In directory nail:/tmp/cvs-serv21486/libbb

Modified Files:
	hash_fd.c 
Log Message:
Apply a couple of optimizations


Index: hash_fd.c
===================================================================
RCS file: /var/cvs/busybox/libbb/hash_fd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- hash_fd.c	20 Nov 2003 21:30:58 -0000	1.3
+++ hash_fd.c	29 Jan 2004 22:33:28 -0000	1.4
@@ -95,9 +95,9 @@
 # define SHA1_MASK   (SHA1_BLOCK_SIZE - 1)
 
 /* reverse byte order in 32-bit words   */
-# define ch(x,y,z)       (((x) & (y)) ^ (~(x) & (z)))
-# define parity(x,y,z)   ((x) ^ (y) ^ (z))
-# define maj(x,y,z)      (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+#define ch(x,y,z)       ((z) ^ ((x) & ((y) ^ (z))))
+#define parity(x,y,z)   ((x) ^ (y) ^ (z))
+#define maj(x,y,z)      (((x) & (y)) | ((z) & ((x) | (y))))
 
 /* A normal version as set out in the FIPS. This version uses   */
 /* partial loop unrolling and is optimised for the Pentium 4    */
@@ -276,6 +276,8 @@
 /* Handle endian-ness */
 # if __BYTE_ORDER == __LITTLE_ENDIAN
 #  define SWAP(n) (n)
+# elif defined(bswap_32)
+#  define SWAP(n) bswap_32(n)
 # else
 #  define SWAP(n) ((n << 24) | ((n&65280)<<8) | ((n&16711680)>>8) | (n>>24))
 # endif




More information about the busybox-cvs mailing list