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