From 844c7e78ae9690706d92981d4be06b165511719d Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 25 Dec 2021 01:45:33 +0000 Subject: [PATCH] Equality operators for TargetMemoryDescriptor and TargetAddressRange --- src/Targets/TargetMemory.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Targets/TargetMemory.hpp b/src/Targets/TargetMemory.hpp index a7556375..b743d118 100644 --- a/src/Targets/TargetMemory.hpp +++ b/src/Targets/TargetMemory.hpp @@ -22,6 +22,10 @@ namespace Bloom::Targets TargetMemoryAddressRange(std::uint32_t startAddress, std::uint32_t endAddress) : startAddress(startAddress), endAddress(endAddress) {}; + bool operator == (const TargetMemoryAddressRange& rhs) const { + return this->startAddress == rhs.startAddress && this->endAddress == rhs.endAddress; + } + [[nodiscard]] bool intersectsWith(const TargetMemoryAddressRange& other) const { return (other.startAddress <= this->startAddress && other.endAddress >= this->startAddress) @@ -38,6 +42,10 @@ namespace Bloom::Targets TargetMemoryDescriptor(TargetMemoryType type, TargetMemoryAddressRange addressRange) : type(type), addressRange(addressRange) {}; + bool operator == (const TargetMemoryDescriptor& rhs) const { + return this->type == rhs.type && this->addressRange == rhs.addressRange; + } + [[nodiscard]] std::uint32_t size() const { return (this->addressRange.endAddress - this->addressRange.startAddress) + 1; }