summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-10-10 17:49:31 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-10-10 17:49:31 -0400
commit404b2a951d82bde00e607296c5e7de2997df8058 (patch)
tree34e78d110da42715505352cb5892b41c2b28d7b9 /src
parent549412b33361629b03d9d85dac3bb3efa2f07baf (diff)
downloadgem5-404b2a951d82bde00e607296c5e7de2997df8058.tar.xz
Fixed a corner case and simplified the logic in Packet::intersect.
--HG-- extra : convert_revision : b57c31ca7c220e701d34e02bb07ce392370e4428
Diffstat (limited to 'src')
-rw-r--r--src/mem/packet.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index 91298df8c..7b8fa4a96 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -102,15 +102,11 @@ bool
Packet::intersect(Packet *p)
{
Addr s1 = getAddr();
- Addr e1 = getAddr() + getSize();
+ Addr e1 = getAddr() + getSize() - 1;
Addr s2 = p->getAddr();
- Addr e2 = p->getAddr() + p->getSize();
+ Addr e2 = p->getAddr() + p->getSize() - 1;
- if (s1 >= s2 && s1 < e2)
- return true;
- if (e1 >= s2 && e1 < e2)
- return true;
- return false;
+ return !(s1 > e2 || e1 < s2);
}
bool