[ip6-address] simplify IsAnycastServiceLocator() (#4519)

This change ensures we avoid comparing values with host-swapped
constants.
This commit is contained in:
Abtin Keshavarzian
2020-02-03 09:11:35 -08:00
committed by Jonathan Hui
parent 16b6c8df89
commit 0f274641f1
+2 -2
View File
@@ -129,8 +129,8 @@ bool Address::IsAnycastRoutingLocator(void) const
bool Address::IsAnycastServiceLocator(void) const
{
return IsAnycastRoutingLocator() && (mFields.m16[7] >= HostSwap16(Mle::kAloc16ServiceStart)) &&
(mFields.m16[7] <= HostSwap16(Mle::kAloc16ServiceEnd));
return IsAnycastRoutingLocator() && (mFields.m8[15] >= (Mle::kAloc16ServiceStart & 0xff)) &&
(mFields.m8[15] <= (Mle::kAloc16ServiceEnd & 0xff));
}
bool Address::IsSubnetRouterAnycast(void) const