Fix out-of-bounds address_v4::broadcast() return value on 64-bit systems.

This commit is contained in:
Christopher Kohlhoff 2011-02-08 13:07:40 +11:00
parent 6f783835d4
commit 0554900ad4

View File

@ -140,7 +140,7 @@ bool address_v4::is_multicast() const
address_v4 address_v4::broadcast(const address_v4& addr, const address_v4& mask)
{
return address_v4(addr.to_ulong() | ~mask.to_ulong());
return address_v4(addr.to_ulong() | (mask.to_ulong() ^ 0xFFFFFFFF));
}
address_v4 address_v4::netmask(const address_v4& addr)