Skip to content

Commit ee0821a

Browse files
Rollup merge of #33891 - polachok:faster-ipv4-cmp, r=bluss
Make Ipv4Addr cmp() faster Closes #33885
2 parents 6636dcc + 7ba0016 commit ee0821a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/net/ip.rs

+1-1
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)