Get pointer from address of c directly
This commit is contained in:
parent
34c343ac27
commit
f55e4d036c
1 changed files with 2 additions and 2 deletions
|
@ -118,9 +118,9 @@ pub fn unrolled_find_u16s(needle: u16, haystack: &[u16]) -> Option<usize> {
|
||||||
start = &start[8..];
|
start = &start[8..];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i, c) in start.iter().enumerate() {
|
for c in start {
|
||||||
if *c == needle {
|
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
|
None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue