Skip to content

Commit 7ba0016

Browse files
author
Alexander Polyakov
committed
Make Ipv4Addr cmp() faster
1 parent dc91467 commit 7ba0016

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/net/ip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl PartialOrd for Ipv4Addr {
251251
#[stable(feature = "rust1", since = "1.0.0")]
252252
impl Ord for Ipv4Addr {
253253
fn cmp(&self, other: &Ipv4Addr) -> Ordering {
254-
self.octets().cmp(&other.octets())
254+
ntoh(self.inner.s_addr).cmp(&ntoh(other.inner.s_addr))
255255
}
256256
}
257257

0 commit comments

Comments
 (0)