changeset c625a3c51bac in /z/repo/gem5 details: http://repo.gem5.org/gem5?cmd=changeset;node=c625a3c51bac description: 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. diffstat: src/base/inet.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 878f2f30b12d -r c625a3c51bac src/base/inet.cc --- a/src/base/inet.cc Wed Jul 02 13:19:13 2014 -0400 +++ b/src/base/inet.cc Wed Jul 09 09:28:15 2014 -0400 @@ -124,7 +124,7 @@ 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 & _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev