Skip to content

Commit

Permalink
Get pointer from address of c directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jul 28, 2020
1 parent 34c343a commit f55e4d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/sys/windows/mod.rs
Expand Up @@ -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
Expand Down

0 comments on commit f55e4d0

Please sign in to comment.