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//===----------------------------------------------------------------------===//
8
9#include "lldb/Utility/Checksum.h"
10#include "llvm/ADT/STLExtras.h"
11#include "llvm/ADT/SmallString.h"
12
13using namespace lldb_private;
14
15Checksum::Checksum(llvm::MD5::MD5Result md5) { SetMD5(md5); }
16
17Checksum::Checksum(const Checksum &checksum) { SetMD5(checksum.m_checksum); }
18
19Checksum &Checksum::operator=(const Checksum &checksum) {
20 SetMD5(checksum.m_checksum);
21 return *this;
22}
23
24void Checksum::SetMD5(llvm::MD5::MD5Result md5) { m_checksum = md5; }
25
26Checksum::operator bool() const { return !llvm::equal(LRange: m_checksum, RRange&: g_sentinel); }
27
28bool Checksum::operator==(const Checksum &checksum) const {
29 return llvm::equal(LRange: m_checksum, RRange: checksum.m_checksum);
30}
31
32bool Checksum::operator!=(const Checksum &checksum) const {
33 return !(*this == checksum);
34}
35
36std::string Checksum::digest() const {
37 return std::string(m_checksum.digest());
38}
39
40llvm::MD5::MD5Result Checksum::g_sentinel = {
41 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
42

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of lldb/source/Utility/Checksum.cpp