From c705670fbec2d404a92261efa0234c614232ec4f Mon Sep 17 00:00:00 2001 From: Pavlin Radoslavov Date: Wed, 30 Aug 2017 11:02:27 -0700 Subject: [PATCH] Inline comparison operators for RawAddress Test: Code compilation Bug: 64975965 Change-Id: I5a7ab7e0cd270c2769a3a471a506fc78a0a94533 --- types/raw_address.cc | 8 -------- types/raw_address.h | 8 ++++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/types/raw_address.cc b/types/raw_address.cc index 83fce6eb7..22c1081ef 100644 --- a/types/raw_address.cc +++ b/types/raw_address.cc @@ -33,14 +33,6 @@ RawAddress::RawAddress(const uint8_t (&addr)[6]) { std::copy(addr, addr + kLength, address); }; -bool RawAddress::operator<(const RawAddress& rhs) const { - return std::memcmp(address, rhs.address, sizeof(address)) < 0; -} - -bool RawAddress::operator==(const RawAddress& rhs) const { - return std::memcmp(address, rhs.address, sizeof(address)) == 0; -} - std::string RawAddress::ToString() const { return base::StringPrintf("%02x:%02x:%02x:%02x:%02x:%02x", address[0], address[1], address[2], address[3], address[4], diff --git a/types/raw_address.h b/types/raw_address.h index b7e4e0fd1..0b42c0453 100644 --- a/types/raw_address.h +++ b/types/raw_address.h @@ -30,11 +30,15 @@ class RawAddress final { RawAddress() = default; RawAddress(const uint8_t (&addr)[6]); - bool operator<(const RawAddress& rhs) const; + bool operator<(const RawAddress& rhs) const { + return (std::memcmp(address, rhs.address, sizeof(address)) < 0); + } + bool operator==(const RawAddress& rhs) const { + return (std::memcmp(address, rhs.address, sizeof(address)) == 0); + } bool operator>(const RawAddress& rhs) const { return (rhs < *this); } bool operator<=(const RawAddress& rhs) const { return !(*this > rhs); } bool operator>=(const RawAddress& rhs) const { return !(*this < rhs); } - bool operator==(const RawAddress& rhs) const; bool operator!=(const RawAddress& rhs) const { return !(*this == rhs); } bool IsEmpty() const { return *this == kEmpty; } -- 2.11.0