From e776d6005b5a62e21b11cde6712559726529a417 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 23 Nov 2016 11:49:28 +0000 Subject: [PATCH] [MD5] Use write32le instead of spelling it out with shifts. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287757 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/MD5.cpp | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/Support/MD5.cpp b/lib/Support/MD5.cpp index e589bfd297a..942571eab0f 100644 --- a/lib/Support/MD5.cpp +++ b/lib/Support/MD5.cpp @@ -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) { -- 2.50.1