From 82a0c97b32c2d581a239308a699f265f144e975b Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 20 Mar 2017 23:33:18 +0000 Subject: Add a function to MD5 a file's contents. In doing so, clean up the MD5 interface a little. Most existing users only care about the lower 8 bytes of an MD5, but for some users that care about the upper and lower, there wasn't a good interface. Furthermore, consumers of the MD5 checksum were required to handle endianness details on their own, so it seems reasonable to abstract this into a nicer interface that just gives you the right value. Differential Revision: https://reviews.llvm.org/D31105 llvm-svn: 298322 --- lldb/source/Host/common/FileSystem.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lldb/source/Host/common/FileSystem.cpp') diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index 88f29b46f36..55092dc8400 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -67,9 +67,7 @@ bool FileSystem::CalculateMD5(const FileSpec &file_spec, uint64_t offset, if (!CalcMD5(file_spec, offset, length, md5_result)) return false; - const auto uint64_res = reinterpret_cast(md5_result); - high = uint64_res[0]; - low = uint64_res[1]; + std::tie(high, low) = md5_result.words(); return true; } -- cgit v1.2.3