File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,8 @@ impl Hash for Ipv4Addr {
79
79
fn hash < H : Hasher > ( & self , state : & mut H ) {
80
80
// Hashers are often more efficient at hashing a fixed-width integer
81
81
// than a bytestring, so convert before hashing. We don't use to_bits()
82
- // here as that involves a byteswap on little-endian machines, which are
83
- // more common than big-endian machines.
84
- u32:: from_le_bytes ( self . octets ) . hash ( state) ;
82
+ // here as that may involve a byteswap which is unnecessary.
83
+ u32:: from_ne_bytes ( self . octets ) . hash ( state) ;
85
84
}
86
85
}
87
86
@@ -172,9 +171,8 @@ impl Hash for Ipv6Addr {
172
171
fn hash < H : Hasher > ( & self , state : & mut H ) {
173
172
// Hashers are often more efficient at hashing a fixed-width integer
174
173
// than a bytestring, so convert before hashing. We don't use to_bits()
175
- // here as that involves byteswaps on little-endian machines, which are
176
- // more common than big-endian machines.
177
- u128:: from_le_bytes ( self . octets ) . hash ( state) ;
174
+ // here as that may involve unnecessary byteswaps.
175
+ u128:: from_ne_bytes ( self . octets ) . hash ( state) ;
178
176
}
179
177
}
180
178
You can’t perform that action at this time.
0 commit comments