Skip to content

Commit df8f172

Browse files
authored
Fix undefined behavior in SSE4.2 test (rust-lang#1341)
1 parent 912a4dd commit df8f172

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

crates/core_arch/src/x86/sse42.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,7 @@ mod tests {
623623
unsafe fn str_to_m128i(s: &[u8]) -> __m128i {
624624
assert!(s.len() <= 16);
625625
let slice = &mut [0u8; 16];
626-
ptr::copy_nonoverlapping(
627-
s.get_unchecked(0) as *const u8 as *const u8,
628-
slice.get_unchecked_mut(0) as *mut u8 as *mut u8,
629-
s.len(),
630-
);
626+
ptr::copy_nonoverlapping(s.as_ptr(), slice.as_mut_ptr(), s.len());
631627
_mm_loadu_si128(slice.as_ptr() as *const _)
632628
}
633629

0 commit comments

Comments
 (0)