File tree 1 file changed +2
-14
lines changed
1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ macro_rules! fill_via_chunks {
58
58
let chunk_size_u8 = min( $src. len( ) * SIZE , $dst. len( ) ) ;
59
59
let chunk_size = ( chunk_size_u8 + SIZE - 1 ) / SIZE ;
60
60
61
+ // The following can be replaced with safe code, but unfortunately it's
62
+ // ca. 8% slower.
61
63
if cfg!( target_endian = "little" ) {
62
64
unsafe {
63
65
core:: ptr:: copy_nonoverlapping(
@@ -78,20 +80,6 @@ macro_rules! fill_via_chunks {
78
80
}
79
81
}
80
82
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
-
95
83
( chunk_size, chunk_size_u8)
96
84
} } ;
97
85
}
You can’t perform that action at this time.
0 commit comments