summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Gutierrez <atgutier@umich.edu>2014-07-09 09:28:15 -0400
committerAnthony Gutierrez <atgutier@umich.edu>2014-07-09 09:28:15 -0400
commit59c8c454ebdb88ca031d7f597e301bbbbdf7617b (patch)
treef0fb7682975ef84c11364239ffa252c0557898b2
parent3956ec0a893f2fe37fe9239c3c790de570e1eb8b (diff)
downloadgem5-59c8c454ebdb88ca031d7f597e301bbbbdf7617b.tar.xz
base: fix operator== for comparing EthAddr objects
this operator uses memcmp() to detect if two EthAddr object have the same address, however memcmp() will return 0 if all bytes are equal. operator== returns the return value of memcmp() to indicate whether or not two address are equal. this is incorrect as it will always give the opposite of the intended behavior. this patch fixes that problem.
-rw-r--r--src/base/inet.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/base/inet.cc b/src/base/inet.cc
index bdd1b57ad..190a7a11e 100644
--- a/src/base/inet.cc
+++ b/src/base/inet.cc
@@ -124,7 +124,7 @@ EthAddr::string() const
bool
operator==(const EthAddr &left, const EthAddr &right)
{
- return memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
+ return !memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
}
ostream &