mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 22:27:47 +00:00
[core] always implement operator != in terms of == (#4188)
This commit is contained in:
committed by
Jonathan Hui
parent
1555b21910
commit
20145cb42f
@@ -234,7 +234,7 @@ public:
|
||||
* @returns TRUE if the two masks are different, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const ChannelMask &aAnother) const { return (mMask != aAnother.mMask); }
|
||||
bool operator!=(const ChannelMask &aAnother) const { return !(*this == aAnother); }
|
||||
|
||||
/**
|
||||
* This method converts the channel mask into a human-readable string.
|
||||
|
||||
@@ -56,11 +56,6 @@ bool ExtAddress::operator==(const ExtAddress &aOther) const
|
||||
return memcmp(m8, aOther.m8, sizeof(ExtAddress)) == 0;
|
||||
}
|
||||
|
||||
bool ExtAddress::operator!=(const ExtAddress &aOther) const
|
||||
{
|
||||
return memcmp(m8, aOther.m8, sizeof(ExtAddress)) != 0;
|
||||
}
|
||||
|
||||
ExtAddress::InfoString ExtAddress::ToString(void) const
|
||||
{
|
||||
return InfoString("%02x%02x%02x%02x%02x%02x%02x%02x", m8[0], m8[1], m8[2], m8[3], m8[4], m8[5], m8[6], m8[7]);
|
||||
@@ -95,11 +90,6 @@ bool ExtendedPanId::operator==(const ExtendedPanId &aOther) const
|
||||
return memcmp(m8, aOther.m8, sizeof(ExtendedPanId)) == 0;
|
||||
}
|
||||
|
||||
bool ExtendedPanId::operator!=(const ExtendedPanId &aOther) const
|
||||
{
|
||||
return memcmp(m8, aOther.m8, sizeof(ExtendedPanId)) != 0;
|
||||
}
|
||||
|
||||
ExtendedPanId::InfoString ExtendedPanId::ToString(void) const
|
||||
{
|
||||
return InfoString("%02x%02x%02x%02x%02x%02x%02x%02x", m8[0], m8[1], m8[2], m8[3], m8[4], m8[5], m8[6], m8[7]);
|
||||
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
* @retval FALSE If the Extended Addresses match.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const ExtAddress &aOther) const;
|
||||
bool operator!=(const ExtAddress &aOther) const { return !(*this == aOther); }
|
||||
|
||||
/**
|
||||
* This method converts an address to a string.
|
||||
@@ -463,7 +463,7 @@ public:
|
||||
* @retval FALSE If the Extended Addresses match.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const ExtendedPanId &aOther) const;
|
||||
bool operator!=(const ExtendedPanId &aOther) const { return !(*this == aOther); }
|
||||
|
||||
/**
|
||||
* This method converts an address to a string.
|
||||
|
||||
@@ -252,11 +252,6 @@ bool Address::operator==(const Address &aOther) const
|
||||
return memcmp(mFields.m8, aOther.mFields.m8, sizeof(mFields.m8)) == 0;
|
||||
}
|
||||
|
||||
bool Address::operator!=(const Address &aOther) const
|
||||
{
|
||||
return memcmp(mFields.m8, aOther.mFields.m8, sizeof(mFields.m8)) != 0;
|
||||
}
|
||||
|
||||
otError Address::FromString(const char *aBuf)
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
@@ -365,7 +365,7 @@ public:
|
||||
* @retval FALSE If the IPv6 addresses do not differ.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const Address &aOther) const;
|
||||
bool operator!=(const Address &aOther) const { return !(*this == aOther); }
|
||||
|
||||
/**
|
||||
* This method converts an IPv6 address string to binary.
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
* @retval FALSE If the device modes are equal.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const DeviceMode &aOther) const { return (mMode != aOther.mMode); }
|
||||
bool operator!=(const DeviceMode &aOther) const { return !(*this == aOther); }
|
||||
|
||||
/**
|
||||
* This method converts the device mode into a human-readable string.
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
* @retval FALSE If the Thread Master Keys match.
|
||||
*
|
||||
*/
|
||||
bool operator!=(const MasterKey &aOther) const { return memcmp(m8, aOther.m8, sizeof(MasterKey)) != 0; }
|
||||
bool operator!=(const MasterKey &aOther) const { return !(*this == aOther); }
|
||||
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user