Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: crypto/p224.cc

Issue 407713002: clean up code at crypto folder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/nss_util.cc ('k') | crypto/p224_spake_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/p224.cc
diff --git a/crypto/p224.cc b/crypto/p224.cc
index ac0a081037f2de25c0d3d40aaf07a0a173c3bcbe..8e8e63709465e66acbdc2aeceae594f330235917 100644
--- a/crypto/p224.cc
+++ b/crypto/p224.cc
@@ -81,9 +81,9 @@ void Add(FieldElement* out, const FieldElement& a, const FieldElement& b) {
}
}
-static const uint32 kTwo31p3 = (1u<<31) + (1u<<3);
-static const uint32 kTwo31m3 = (1u<<31) - (1u<<3);
-static const uint32 kTwo31m15m3 = (1u<<31) - (1u<<15) - (1u<<3);
+static const uint32 kTwo31p3 = (1u << 31) + (1u << 3);
agl 2014/07/21 13:36:10 I think this is worse because it's really writing
rucifer1217 2014/07/21 16:28:10 yes, your opinion is right. i will revert code.
+static const uint32 kTwo31m3 = (1u << 31) - (1u << 3);
+static const uint32 kTwo31m15m3 = (1u << 31) - (1u << 15) - (1u << 3);
// kZero31ModP is 0 mod p where bit 31 is set in all limbs so that we can
// subtract smaller amounts without underflow. See the section "Subtraction" in
// [1] for why.
@@ -149,7 +149,7 @@ void ReduceLarge(FieldElement* out, LargeFieldElement* inptr) {
// Eliminate the term at 2*224 that we introduced while keeping the same
// value mod p.
in[0] -= in[8]; // reflection off the "+1" term of p.
- (*out)[3] += static_cast<uint32>(in[8] & 0xffff) << 12; // "-2**96" term
+ (*out)[3] += static_cast<uint32>(in[8] & 0xffff) << 12; // "-2**96" term
(*out)[4] += static_cast<uint32>(in[8] >> 16); // rest of "-2**96" term
// in[0] < 2**64
// out[3] < 2**29
@@ -638,7 +638,7 @@ void Put224Bits(uint32* out, const uint32* in) {
out[0] = HostToNet32((in[6] >> 24) | (in[7] << 4));
}
-} // anonymous namespace
+} // anonymous namespace
namespace crypto {
« no previous file with comments | « crypto/nss_util.cc ('k') | crypto/p224_spake_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698