about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-22 07:26:58 +0000
committerbors <bors@rust-lang.org>2020-02-22 07:26:58 +0000
commit03d2f5cd6c634b1fdcd26b036009aa4dce37fdfc (patch)
tree276884fec5a6f84d9fdf190a5f4babafe8a28d35 /src/libcore
parent87e494c4cdf3f4f39d25ca008173f80688b8eb3d (diff)
parent100ff5a25666a1903113ecff0dc63ad84e5bdff7 (diff)
downloadrust-03d2f5cd6c634b1fdcd26b036009aa4dce37fdfc.tar.gz
rust-03d2f5cd6c634b1fdcd26b036009aa4dce37fdfc.zip
Auto merge of #69332 - nnethercote:revert-u8to64_le-changes, r=michaelwoerister
Revert `u8to64_le` changes from #68914.

`SipHasher128`'s `u8to64_le` function was simplified in #68914.
Unfortunately, the new version is slower, because it introduces `memcpy`
calls with non-statically-known lengths.

This commit reverts the change, and adds an explanatory comment (which
is also added to `libcore/hash/sip.rs`). This barely affects
`SipHasher128`'s speed because it doesn't use `u8to64_le` much, but it
does result in `SipHasher128` once again being consistent with
`libcore/hash/sip.rs`.

r? @michaelwoerister
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/hash/sip.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs
index 7ebe01e26dc..c4fbd9dbada 100644
--- a/src/libcore/hash/sip.rs
+++ b/src/libcore/hash/sip.rs
@@ -121,7 +121,9 @@ macro_rules! load_int_le {
     }};
 }
 
-/// Loads an u64 using up to 7 bytes of a byte slice.
+/// Loads a u64 using up to 7 bytes of a byte slice. It looks clumsy but the
+/// `copy_nonoverlapping` calls that occur (via `load_int_le!`) all have fixed
+/// sizes and avoid calling `memcpy`, which is good for speed.
 ///
 /// Unsafe because: unchecked indexing at start..start+len
 #[inline]