diff options
Diffstat (limited to 'net/dns/address_sorter_posix.cc')
-rw-r--r-- | net/dns/address_sorter_posix.cc | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc index 8d87774..514a00f 100644 --- a/net/dns/address_sorter_posix.cc +++ b/net/dns/address_sorter_posix.cc @@ -175,30 +175,6 @@ AddressSorterPosix::PolicyEntry kDefaultIPv4ScopeTable[] = { { { }, 0, AddressSorterPosix::SCOPE_GLOBAL }, }; -// Returns number of matching initial bits between the addresses |a1| and |a2|. -unsigned CommonPrefixLength(const IPAddressNumber& a1, - const IPAddressNumber& a2) { - DCHECK_EQ(a1.size(), a2.size()); - for (size_t i = 0; i < a1.size(); ++i) { - unsigned diff = a1[i] ^ a2[i]; - if (!diff) - continue; - for (unsigned j = 0; j < CHAR_BIT; ++j) { - if (diff & (1 << (CHAR_BIT - 1))) - return i * CHAR_BIT + j; - diff <<= 1; - } - NOTREACHED(); - } - return a1.size() * CHAR_BIT; -} - -// Computes the number of leading 1-bits in |mask|. -unsigned MaskPrefixLength(const IPAddressNumber& mask) { - IPAddressNumber all_ones(mask.size(), 0xFF); - return CommonPrefixLength(mask, all_ones); -} - struct DestinationInfo { IPAddressNumber address; AddressSorterPosix::AddressScope scope; |