diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-01-29 22:33:28 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-01-29 22:33:28 +0000 |
commit | f88bb72f1fa65ea05293775d01eae79a341302d6 (patch) | |
tree | cdbd981eeb7a839d477648a54cb0bcd20d8b180a /libbb | |
parent | 242ab8349995f97807896835a6c680d57567aa1a (diff) | |
download | busybox-f88bb72f1fa65ea05293775d01eae79a341302d6.tar.gz |
Apply a couple of optimizations
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/hash_fd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libbb/hash_fd.c b/libbb/hash_fd.c index 770ba09c4..58394522f 100644 --- a/libbb/hash_fd.c +++ b/libbb/hash_fd.c @@ -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 @@ void sha1_end(unsigned char hval[], sha1_ctx_t *ctx) /* 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 |