MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / sub_ptr

Function sub_ptr

src/fast.rs:35–38  ·  view source on GitHub ↗
(ptr: *mut T, origin: *mut T)

Source from the content-addressed store, hash-verified

33/// Replacement for `feature = "ptr_sub_ptr"` which isn't yet stable.
34#[inline(always)]
35fn sub_ptr<T>(ptr: *mut T, origin: *mut T) -> usize {
36 // unsafe { ptr.sub_ptr(origin) }
37 (ptr as usize - origin as usize) / std::mem::size_of::<T>()
38}
39
40impl<T> From<FastVec<T>> for Vec<T> {
41 fn from(fast: FastVec<T>) -> Self {

Callers 4

fromMethod · 0.85
lenMethod · 0.85
reserveMethod · 0.85
as_sliceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected