aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJean-Luc Cooke <jlcooke@certainkey.com>2004-01-27 23:13:56 -0800
committerHideaki Yoshifuji <yoshfuji@linux-ipv6.org>2004-01-27 23:13:56 -0800
commit27f7bfe14dc4ee472abdab022ec7f5876f78ad8d (patch)
tree4589dd6274b560dcf2f24aacfb10dce977a84d1c /crypto
parent01477f1cd26768296f4c19c2d1592f8c3b97d9f1 (diff)
downloadhistory-27f7bfe14dc4ee472abdab022ec7f5876f78ad8d.tar.gz
[CRYPTO]: Help gcc optimize sha256/sha512 better.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/sha256.c4
-rw-r--r--crypto/sha512.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/crypto/sha256.c b/crypto/sha256.c
index 030fe5cc6a644b..e972be7921b222 100644
--- a/crypto/sha256.c
+++ b/crypto/sha256.c
@@ -34,12 +34,12 @@ struct sha256_ctx {
static inline u32 Ch(u32 x, u32 y, u32 z)
{
- return ((x & y) ^ (~x & z));
+ return z ^ (x & (y ^ z));
}
static inline u32 Maj(u32 x, u32 y, u32 z)
{
- return ((x & y) ^ (x & z) ^ (y & z));
+ return (x & y) | (z & (x | y));
}
static inline u32 RORu32(u32 x, u32 y)
diff --git a/crypto/sha512.c b/crypto/sha512.c
index 3d528d89e37a14..5722fad6d5fca9 100644
--- a/crypto/sha512.c
+++ b/crypto/sha512.c
@@ -34,12 +34,12 @@ struct sha512_ctx {
static inline u64 Ch(u64 x, u64 y, u64 z)
{
- return ((x & y) ^ (~x & z));
+ return z ^ (x & (y ^ z));
}
static inline u64 Maj(u64 x, u64 y, u64 z)
{
- return ((x & y) ^ (x & z) ^ (y & z));
+ return (x & y) | (z & (x | y));
}
static inline u64 RORu64(u64 x, u64 y)