Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: net/dns/address_sorter_posix.cc

Issue 23726043: Added NetworkInterface::network_prefix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/base/net_util_unittest.cc ('K') | « net/base/net_util_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/address_sorter_posix.cc
diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc
index 8d87774587d8e59a52891ce74994e76bd1c697a9..514a00f8ebf65d8f8b17b35387eee29c8dd6ea4d 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;
« net/base/net_util_unittest.cc ('K') | « net/base/net_util_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698