diff --git a/src/byteset/scalar.rs b/src/byteset/scalar.rs index 8148daf..4d9fdd6 100644 --- a/src/byteset/scalar.rs +++ b/src/byteset/scalar.rs @@ -67,7 +67,7 @@ pub fn inv_memrchr(n1: u8, haystack: &[u8]) -> Option { let loop_size = cmp::min(LOOP_SIZE, haystack.len()); let align = USIZE_BYTES - 1; let start_ptr = haystack.as_ptr(); - let end_ptr = haystack[haystack.len()..].as_ptr(); + let end_ptr = unsafe { haystack.as_ptr().add(haystack.len()) }; let mut ptr = end_ptr; unsafe { diff --git a/src/ext_slice.rs b/src/ext_slice.rs index 2cc9649..b0287e9 100644 --- a/src/ext_slice.rs +++ b/src/ext_slice.rs @@ -3063,11 +3063,8 @@ pub trait ByteSlice: Sealed { // Finally, we are only dealing with u8 data, which is Copy, which // means we can copy without worrying about ownership/destructors. unsafe { - ptr::copy( - self.as_bytes().get_unchecked(src_start), - self.as_bytes_mut().get_unchecked_mut(dest), - count, - ); + let ptr = self.as_bytes_mut().as_mut_ptr(); + ptr::copy(ptr.add(src_start), ptr.add(dest), count); } } }