We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fill_zeroes
ptr::write_bytes
1 parent 13f4ae0 commit 1400815Copy full SHA for 1400815
src/lib.rs
@@ -532,8 +532,8 @@ pub fn fill_zeroes<T: Zeroable>(slice: &mut [T]) {
532
slice.iter_mut().for_each(write_zeroes);
533
} else {
534
// Otherwise we can be really fast and just fill everthing with zeros.
535
- let len = core::mem::size_of_val::<[T]>(slice);
536
- unsafe { core::ptr::write_bytes(slice.as_mut_ptr() as *mut u8, 0u8, len) }
+ let len = slice.len();
+ unsafe { core::ptr::write_bytes(slice.as_mut_ptr(), 0u8, len) }
537
}
538
539
0 commit comments