Skip to content

Commit 39df557

Browse files
committed
Delete dead code
1 parent 0eb00bd commit 39df557

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

rand_core/src/impls.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ macro_rules! fill_via_chunks {
5959
let chunk_size_u8 = min($src.len() * SIZE, $dst.len());
6060
let chunk_size = (chunk_size_u8 + SIZE - 1) / SIZE;
6161

62+
// The following can be replaced with safe code, but unfortunately it's
63+
// ca. 8% slower.
6264
if cfg!(target_endian = "little") {
6365
unsafe {
6466
core::ptr::copy_nonoverlapping(
@@ -79,20 +81,6 @@ macro_rules! fill_via_chunks {
7981
}
8082
}
8183

82-
// The following code is a safe replacement, but unfortunately ca. 8%
83-
// slower.
84-
/*
85-
let mut iter_src = $src.iter();
86-
let mut chunks = $dst.chunks_exact_mut(SIZE);
87-
for (chunk, n) in (&mut chunks).zip(&mut iter_src) {
88-
chunk.copy_from_slice(&n.to_le_bytes());
89-
}
90-
let rem = chunks.into_remainder();
91-
if let Some(n) = iter_src.next() {
92-
rem.copy_from_slice(&n.to_le_bytes()[..rem.len()]);
93-
}
94-
*/
95-
9684
(chunk_size, chunk_size_u8)
9785
}};
9886
}

0 commit comments

Comments
 (0)