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

Unified Diff: base/md5.cc

Issue 1065733005: base: Use a simple tricky to remove a temporary variable in MD5DigestToBase16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use thestig's tricky Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/md5.cc
diff --git a/base/md5.cc b/base/md5.cc
index 737c7c47b0fd7d7b4faa561404634d201f03649e..064e28acf102b4dd7ec82e5a71210dea35d344be 100644
--- a/base/md5.cc
+++ b/base/md5.cc
@@ -276,11 +276,10 @@ std::string MD5DigestToBase16(const MD5Digest& digest) {
std::string ret;
ret.resize(32);
- int j = 0;
- for (int i = 0; i < 16; i++) {
+ for (int i = 0, j = 0; i < 16; i++, j += 2) {
int a = digest.a[i];
- ret[j++] = zEncode[(a >> 4) & 0xf];
- ret[j++] = zEncode[a & 0xf];
+ ret[j] = zEncode[(a >> 4) & 0xf];
+ ret[j + 1] = zEncode[a & 0xf];
}
return ret;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698