Make Ipv4Addr cmp() faster

This commit is contained in:
Alexander Polyakov 2016-05-26 22:38:33 +03:00
parent dc91467db0
commit 7ba0016030

View file

@ -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))
}
}