From 45d5afb10e147ae3894a12e6d1f050bcd22d1dc4 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 30 Jan 2020 18:47:26 -0800 Subject: [PATCH] [ip6-address] inline very simple methods (#4519) This commit inlines the very simple methods (containing a single basic operation) in `Ip6::Address` class. --- src/core/net/ip6_address.cpp | 15 --------------- src/core/net/ip6_address.hpp | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/core/net/ip6_address.cpp b/src/core/net/ip6_address.cpp index 2c1b8c731..8e0981096 100644 --- a/src/core/net/ip6_address.cpp +++ b/src/core/net/ip6_address.cpp @@ -65,11 +65,6 @@ bool Address::IsLinkLocal(void) const return (mFields.m16[0] & HostSwap16(0xffc0)) == HostSwap16(0xfe80); } -bool Address::IsMulticast(void) const -{ - return mFields.m8[0] == 0xff; -} - bool Address::IsLinkLocalMulticast(void) const { return IsMulticast() && (GetScope() == kLinkLocalScope); @@ -149,16 +144,6 @@ bool Address::IsIidReserved(void) const return IsSubnetRouterAnycast() || IsReservedSubnetAnycast() || IsAnycastRoutingLocator(); } -const uint8_t *Address::GetIid(void) const -{ - return mFields.m8 + kInterfaceIdentifierOffset; -} - -uint8_t *Address::GetIid(void) -{ - return mFields.m8 + kInterfaceIdentifierOffset; -} - void Address::SetIid(const uint8_t *aIid) { memcpy(mFields.m8 + kInterfaceIdentifierOffset, aIid, kInterfaceIdentifierSize); diff --git a/src/core/net/ip6_address.hpp b/src/core/net/ip6_address.hpp index ff42482a9..3b7a9ff17 100644 --- a/src/core/net/ip6_address.hpp +++ b/src/core/net/ip6_address.hpp @@ -142,7 +142,7 @@ public: * @retval FALSE If the IPv6 address scope is not a multicast address. * */ - bool IsMulticast(void) const; + bool IsMulticast(void) const { return mFields.m8[0] == 0xff; } /** * This method indicates whether or not the IPv6 address is a link-local multicast address. @@ -276,7 +276,7 @@ public: * @returns A pointer to the Interface Identifier. * */ - const uint8_t *GetIid(void) const; + const uint8_t *GetIid(void) const { return mFields.m8 + kInterfaceIdentifierOffset; } /** * This method returns a pointer to the Interface Identifier. @@ -284,7 +284,7 @@ public: * @returns A pointer to the Interface Identifier. * */ - uint8_t *GetIid(void); + uint8_t *GetIid(void) { return mFields.m8 + kInterfaceIdentifierOffset; } /** * This method sets the Interface Identifier.