Skip to content

Commit 0f90a3b

Browse files
committed
Explicit not equals
1 parent 755ca5d commit 0f90a3b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cores/esp32/IPAddress.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ bool IPAddress::operator==(const IPAddress& addr) const
113113
&& (memcmp(addr._address.bytes, _address.bytes, sizeof(_address.bytes)) == 0);
114114
}
115115

116+
bool IPAddress::operator!=(const IPAddress& addr) const
117+
{
118+
return (addr._type != _type)
119+
|| (memcmp(addr._address.bytes, _address.bytes, sizeof(_address.bytes)) != 0);
120+
}
121+
116122
bool IPAddress::operator==(const uint8_t* addr) const
117123
{
118124
// IPv4 only comparison to byte pointer

cores/esp32/IPAddress.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class IPAddress: public Printable
7575
}
7676

7777
bool operator==(const IPAddress& addr) const;
78-
bool operator!=(const IPAddress& addr) const { return !(*this == addr); };
78+
bool operator!=(const IPAddress& addr) const;
7979
bool operator==(const uint8_t* addr) const;
8080

8181
// Overloaded index operator to allow getting and setting individual octets of the address

0 commit comments

Comments
 (0)