From 7ba001603072284e084628c5e282ecf99aa2f281 Mon Sep 17 00:00:00 2001 From: Alexander Polyakov Date: Thu, 26 May 2016 22:38:33 +0300 Subject: [PATCH] Make Ipv4Addr cmp() faster --- src/libstd/net/ip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 45b85d600a656..ba485f819f880 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -251,7 +251,7 @@ impl PartialOrd for Ipv4Addr { #[stable(feature = "rust1", since = "1.0.0")] impl Ord for Ipv4Addr { fn cmp(&self, other: &Ipv4Addr) -> Ordering { - self.octets().cmp(&other.octets()) + ntoh(self.inner.s_addr).cmp(&ntoh(other.inner.s_addr)) } }