From 404b2a951d82bde00e607296c5e7de2997df8058 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 10 Oct 2006 17:49:31 -0400 Subject: [PATCH] Fixed a corner case and simplified the logic in Packet::intersect. --HG-- extra : convert_revision : b57c31ca7c220e701d34e02bb07ce392370e4428 --- src/mem/packet.cc | 10 +++------- 1 file 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 -- 2.30.2