Get pointer from address of c directly

This commit is contained in:
Lzu Tao 2020-07-13 09:35:51 +00:00
parent 34c343ac27
commit f55e4d036c
1 changed files with 2 additions and 2 deletions

View File

@ -118,9 +118,9 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> {
start = &start[8..];
}
for (i, c) in start.iter().enumerate() {
for c in start {
if *c == needle {
return Some((start.as_ptr() as usize - ptr as usize) / 2 + i);
return Some((c as *const u16 as usize - ptr as usize) / 2);
}
}
None