Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/50346 )
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
Change subject: base: Fix some style problems in addr_range.hh.
......................................................................
base: Fix some style problems in addr_range.hh.
Change-Id: Ib55b86350c4bc3f1f44af996db25a1e44826d077
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50346
Tested-by: kokoro <[email protected]>
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Daniel Carvalho <[email protected]>
---
M src/base/addr_range.hh
1 file changed, 42 insertions(+), 21 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/addr_range.hh b/src/base/addr_range.hh
index 04dc8ec..eb611cc 100644
--- a/src/base/addr_range.hh
+++ b/src/base/addr_range.hh
@@ -266,7 +266,8 @@
*
* @ingroup api_addr_range
*/
- uint64_t granularity() const
+ uint64_t
+ granularity() const
{
if (interleaved()) {
auto combined_mask = 0;
@@ -297,7 +298,8 @@
*
* @ingroup api_addr_range
*/
- Addr size() const
+ Addr
+ size() const
{
return (_end - _start) >> masks.size();
}
@@ -330,7 +332,8 @@
*
* @ingroup api_addr_range
*/
- std::string to_string() const
+ std::string
+ to_string() const
{
if (interleaved()) {
std::string str;
@@ -360,7 +363,8 @@
*
* @ingroup api_addr_range
*/
- bool mergesWith(const AddrRange& r) const
+ bool
+ mergesWith(const AddrRange& r) const
{
return r._start == _start && r._end == _end &&
r.masks == masks;
@@ -376,28 +380,31 @@
*
* @ingroup api_addr_range
*/
- bool intersects(const AddrRange& r) const
+ bool
+ intersects(const AddrRange& r) const
{
- if (_start >= r._end || _end <= r._start)
+ if (_start >= r._end || _end <= r._start) {
// start with the simple case of no overlap at all,
// applicable even if we have interleaved ranges
return false;
- else if (!interleaved() && !r.interleaved())
+ } else if (!interleaved() && !r.interleaved()) {
// if neither range is interleaved, we are done
return true;
+ }
// now it gets complicated, focus on the cases we care about
- if (r.size() == 1)
+ if (r.size() == 1) {
// keep it simple and check if the address is within
// this range
return contains(r.start());
- else if (mergesWith(r))
+ } else if (mergesWith(r)) {
// restrict the check to ranges that belong to the
// same chunk
return intlvMatch == r.intlvMatch;
- else
+ } else {
panic("Cannot test intersection of %s and %s\n",
to_string(), r.to_string());
+ }
}
/**
@@ -410,7 +417,8 @@
*
* @ingroup api_addr_range
*/
- bool isSubset(const AddrRange& r) const
+ bool
+ isSubset(const AddrRange& r) const
{
if (interleaved())
panic("Cannot test subset of interleaved range %s\n",
to_string());
@@ -435,7 +443,8 @@
*
* @ingroup api_addr_range
*/
- bool contains(const Addr& a) const
+ bool
+ contains(const Addr& a) const
{
// check if the address is in the range and if there is either
// no interleaving, or with interleaving also if the selected
@@ -480,7 +489,8 @@
*
* @ingroup api_addr_range
*/
- inline Addr removeIntlvBits(Addr a) const
+ inline Addr
+ removeIntlvBits(Addr a) const
{
// Directly return the address if the range is not interleaved
// to prevent undefined behavior.
@@ -518,7 +528,8 @@
*
* @ingroup api_addr_range
*/
- inline Addr addIntlvBits(Addr a) const
+ inline Addr
+ addIntlvBits(Addr a) const
{
// Directly return the address if the range is not interleaved
// to prevent undefined behavior.
@@ -572,7 +583,8 @@
*
* @ingroup api_addr_range
*/
- Addr getOffset(const Addr& a) const
+ Addr
+ getOffset(const Addr& a) const
{
bool in_range = a >= _start && a < _end;
if (!in_range) {
@@ -650,7 +662,8 @@
*
* @ingroup api_addr_range
*/
- bool operator<(const AddrRange& r) const
+ bool
+ operator<(const AddrRange& r) const
{
if (_start != r._start) {
return _start < r._start;
@@ -670,7 +683,8 @@
/**
* @ingroup api_addr_range
*/
- bool operator==(const AddrRange& r) const
+ bool
+ operator==(const AddrRange& r) const
{
if (_start != r._start) return false;
if (_end != r._end) return false;
@@ -683,7 +697,8 @@
/**
* @ingroup api_addr_range
*/
- bool operator!=(const AddrRange& r) const
+ bool
+ operator!=(const AddrRange& r) const
{
return !(*this == r);
}
@@ -701,21 +716,27 @@
*/
inline AddrRange
RangeEx(Addr start, Addr end)
-{ return AddrRange(start, end); }
+{
+ return AddrRange(start, end);
+}
/**
* @ingroup api_addr_range
*/
inline AddrRange
RangeIn(Addr start, Addr end)
-{ return AddrRange(start, end + 1); }
+{
+ return AddrRange(start, end + 1);
+}
/**
* @ingroup api_addr_range
*/
inline AddrRange
RangeSize(Addr start, Addr size)
-{ return AddrRange(start, start + size); }
+{
+ return AddrRange(start, start + size);
+}
} // namespace gem5
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50346
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib55b86350c4bc3f1f44af996db25a1e44826d077
Gerrit-Change-Number: 50346
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s