[llvm] r287757 - [MD5] Use write32le instead of spelling it out with shifts.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 23 03:49:28 PST 2016
Author: d0k
Date: Wed Nov 23 05:49:28 2016
New Revision: 287757
URL: http://llvm.org/viewvc/llvm-project?rev=287757&view=rev
Log:
[MD5] Use write32le instead of spelling it out with shifts.
No functionality change intended.
Modified:
llvm/trunk/lib/Support/MD5.cpp
Modified: llvm/trunk/lib/Support/MD5.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MD5.cpp?rev=287757&r1=287756&r2=287757&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MD5.cpp (original)
+++ llvm/trunk/lib/Support/MD5.cpp Wed Nov 23 05:49:28 2016
@@ -248,33 +248,15 @@ void MD5::final(MD5Result &Result) {
memset(&buffer[used], 0, free - 8);
lo <<= 3;
- buffer[56] = lo;
- buffer[57] = lo >> 8;
- buffer[58] = lo >> 16;
- buffer[59] = lo >> 24;
- buffer[60] = hi;
- buffer[61] = hi >> 8;
- buffer[62] = hi >> 16;
- buffer[63] = hi >> 24;
+ support::endian::write32le(&buffer[56], lo);
+ support::endian::write32le(&buffer[60], hi);
body(makeArrayRef(buffer, 64));
- Result[0] = a;
- Result[1] = a >> 8;
- Result[2] = a >> 16;
- Result[3] = a >> 24;
- Result[4] = b;
- Result[5] = b >> 8;
- Result[6] = b >> 16;
- Result[7] = b >> 24;
- Result[8] = c;
- Result[9] = c >> 8;
- Result[10] = c >> 16;
- Result[11] = c >> 24;
- Result[12] = d;
- Result[13] = d >> 8;
- Result[14] = d >> 16;
- Result[15] = d >> 24;
+ support::endian::write32le(&Result[0], a);
+ support::endian::write32le(&Result[4], b);
+ support::endian::write32le(&Result[8], c);
+ support::endian::write32le(&Result[12], d);
}
void MD5::stringifyResult(MD5Result &Result, SmallString<32> &Str) {
More information about the llvm-commits
mailing list