summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Dunham <Curtis.Dunham@arm.com>2015-02-03 14:25:58 -0500
committerCurtis Dunham <Curtis.Dunham@arm.com>2015-02-03 14:25:58 -0500
commitf0a764edc6dd9c844a1514a005f0695a9149b58a (patch)
tree8a350e7531fe7bbf4d55d25eec31e4b364d15dc5
parent28a7cea2b3208e3f01cada58dab0be656dfb85fd (diff)
downloadgem5-f0a764edc6dd9c844a1514a005f0695a9149b58a.tar.xz
base: add an accessor and operators ==,!= to address ranges
-rw-r--r--src/base/addr_range.hh21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/base/addr_range.hh b/src/base/addr_range.hh
index 57db8db71..2a20863b4 100644
--- a/src/base/addr_range.hh
+++ b/src/base/addr_range.hh
@@ -227,6 +227,11 @@ class AddrRange
Addr start() const { return _start; }
/**
+ * Get the end address of the range.
+ */
+ Addr end() const { return _end; }
+
+ /**
* Get a string representation of the range. This could
* alternatively be implemented as a operator<<, but at the moment
* that seems like overkill.
@@ -363,6 +368,22 @@ class AddrRange
return intlvMatch < r.intlvMatch;
}
+ bool operator==(const AddrRange& r) const
+ {
+ if (_start != r._start) return false;
+ if (_end != r._end) return false;
+ if (intlvBits != r.intlvBits) return false;
+ if (intlvBits != 0) {
+ if (intlvHighBit != r.intlvHighBit) return false;
+ if (intlvMatch != r.intlvMatch) return false;
+ }
+ return true;
+ }
+
+ bool operator!=(const AddrRange& r) const
+ {
+ return !(*this == r);
+ }
#endif // SWIG
};