[mlir][int-range] Limit xor int range inference to i1 (#116968)
[llvm-project.git] / lldb / source / Utility / Checksum.cpp
blob8943b4e1285208ee327d39d4ffe49958adad0408
1 //===-- Checksum.cpp ------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/Checksum.h"
10 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/ADT/SmallString.h"
13 using namespace lldb_private;
15 Checksum::Checksum(llvm::MD5::MD5Result md5) { SetMD5(md5); }
17 Checksum::Checksum(const Checksum &checksum) { SetMD5(checksum.m_checksum); }
19 Checksum &Checksum::operator=(const Checksum &checksum) {
20 SetMD5(checksum.m_checksum);
21 return *this;
24 void Checksum::SetMD5(llvm::MD5::MD5Result md5) {
25 const constexpr size_t md5_length = 16;
26 std::uninitialized_copy_n(md5.begin(), md5_length, m_checksum.begin());
29 Checksum::operator bool() const { return !llvm::equal(m_checksum, g_sentinel); }
31 bool Checksum::operator==(const Checksum &checksum) const {
32 return llvm::equal(m_checksum, checksum.m_checksum);
35 bool Checksum::operator!=(const Checksum &checksum) const {
36 return !(*this == checksum);
39 std::string Checksum::digest() const {
40 return std::string(m_checksum.digest());
43 llvm::MD5::MD5Result Checksum::g_sentinel = {
44 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};