summaryrefslogtreecommitdiff
path: root/block-sha1
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-08-06 14:27:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-08-06 20:56:45 (GMT)
commite869e113c8f91999f9a433436e0b863fe2727b61 (patch)
tree06462d71c0f8dbbf735da04994967cc0e92f9da2 /block-sha1
parentab14c823dfbf1245712c8179952b51822135d8a8 (diff)
downloadgit-e869e113c8f91999f9a433436e0b863fe2727b61.zip
git-e869e113c8f91999f9a433436e0b863fe2727b61.tar.gz
git-e869e113c8f91999f9a433436e0b863fe2727b61.tar.bz2
block-sha1: Use '(B&C)+(D&(B^C))' instead of '(B&C)|(D&(B|C))' in round 3
It's an equivalent expression, but the '+' gives us some freedom in instruction selection (for example, we can use 'lea' rather than 'add'), and associates with the other additions around it to give some minor scheduling freedom. Suggested-by: linux@horizon.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'block-sha1')
-rw-r--r--block-sha1/sha1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block-sha1/sha1.c b/block-sha1/sha1.c
index 53c93ba..5bf1b36 100644
--- a/block-sha1/sha1.c
+++ b/block-sha1/sha1.c
@@ -112,7 +112,7 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
#define T_0_15(t) SHA_ROUND(t, SHA_SRC, (((C^D)&B)^D) , 0x5a827999 )
#define T_16_19(t) SHA_ROUND(t, SHA_MIX, (((C^D)&B)^D) , 0x5a827999 )
#define T_20_39(t) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0x6ed9eba1 )
-#define T_40_59(t) SHA_ROUND(t, SHA_MIX, ((B&C)|(D&(B|C))) , 0x8f1bbcdc )
+#define T_40_59(t) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc )
#define T_60_79(t) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0xca62c1d6 )
static void blk_SHA1Block(blk_SHA_CTX *ctx, const unsigned int *data)