haystack.len(),
)
};
- if p.is_null() { None } else { Some(p as usize - (haystack.as_ptr() as usize)) }
+ if p.is_null() { None } else { Some(p.addr() - haystack.as_ptr().addr()) }
}
pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize> {
haystack.len(),
)
};
- if p.is_null() { None } else { Some(p as usize - (haystack.as_ptr() as usize)) }
+ // FIXME: this should *likely* use `offset_from`, but more
+ // investigation is needed (including running tests in miri).
+ if p.is_null() { None } else { Some(p.addr() - haystack.as_ptr().addr()) }
}
#[cfg(not(target_os = "linux"))]