aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-08-03 21:32:25 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-08-03 21:32:25 +0300
commit5dcffdbcc23a68abc3ac3539b30be71bc9b5af84 (patch)
tree7c3ae0e92d75e1f3c9afd338fd74ed67f560670d /src
parentliblzma: SHA-256: Optimize the way rotations are done. (diff)
downloadxz-5dcffdbcc23a68abc3ac3539b30be71bc9b5af84.tar.xz
liblzma: SHA-256: Optimize the Maj macro slightly.
The Maj macro is used where multiple things are added together, so making Maj a sum of two expressions allows some extra freedom for the compiler to schedule the instructions. I learned this trick from <http://www.hackersdelight.org/corres.txt>.
Diffstat (limited to '')
-rw-r--r--src/liblzma/check/sha256.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/liblzma/check/sha256.c b/src/liblzma/check/sha256.c
index e0e2f10b..5eede5ce 100644
--- a/src/liblzma/check/sha256.c
+++ b/src/liblzma/check/sha256.c
@@ -36,7 +36,7 @@ rotr_32(uint32_t num, unsigned amount)
+ s0(W[(i - 15) & 15]))
#define Ch(x, y, z) (z ^ (x & (y ^ z)))
-#define Maj(x, y, z) ((x & y) | (z & (x | y)))
+#define Maj(x, y, z) ((x & (y ^ z)) + (y & z))
#define a(i) T[(0 - i) & 7]
#define b(i) T[(1 - i) & 7]