Skip to content

Commit 11439b5

Browse files
committed
Delete dead code
1 parent 422bb44 commit 11439b5

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
@@ -58,6 +58,8 @@ macro_rules! fill_via_chunks {
5858
let chunk_size_u8 = min($src.len() * SIZE, $dst.len());
5959
let chunk_size = (chunk_size_u8 + SIZE - 1) / SIZE;
6060

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

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

0 commit comments

Comments
 (0)