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.
pointer::add
1 parent a2cdbf8 commit 495fa48Copy full SHA for 495fa48
library/core/src/slice/memchr.rs
@@ -124,8 +124,8 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option<usize> {
124
// SAFETY: offset starts at len - suffix.len(), as long as it is greater than
125
// min_aligned_offset (prefix.len()) the remaining distance is at least 2 * chunk_bytes.
126
unsafe {
127
- let u = *(ptr.offset(offset as isize - 2 * chunk_bytes as isize) as *const Chunk);
128
- let v = *(ptr.offset(offset as isize - chunk_bytes as isize) as *const Chunk);
+ let u = *(ptr.add(offset - 2 * chunk_bytes) as *const Chunk);
+ let v = *(ptr.add(offset - chunk_bytes) as *const Chunk);
129
130
// Break if there is a matching byte.
131
let zu = contains_zero_byte(u ^ repeated_x);
0 commit comments