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>.
This commit is contained in:
Lasse Collin 2014-08-03 21:32:25 +03:00
parent a9477d1e0c
commit 5dcffdbcc2
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ rotr_32(uint32_t num, unsigned amount)
+ s0(W[(i - 15) & 15])) + s0(W[(i - 15) & 15]))
#define Ch(x, y, z) (z ^ (x & (y ^ z))) #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 a(i) T[(0 - i) & 7]
#define b(i) T[(1 - i) & 7] #define b(i) T[(1 - i) & 7]