Address range intersection function

This commit is contained in:
Nav
2021-12-22 03:33:54 +00:00
parent 40b2f498b6
commit 3e0aebd9a1

View File

@@ -21,6 +21,13 @@ namespace Bloom::Targets
TargetMemoryAddressRange() = default;
TargetMemoryAddressRange(std::uint32_t startAddress, std::uint32_t endAddress)
: startAddress(startAddress), endAddress(endAddress) {};
[[nodiscard]] bool intersectsWith(const TargetMemoryAddressRange& other) const {
return
(other.startAddress <= this->startAddress && other.endAddress >= this->startAddress)
|| (other.endAddress >= this->endAddress && other.startAddress <= this->endAddress)
;
}
};
struct TargetMemoryDescriptor