MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / offset

Method offset

crates/cust/src/memory/pointer.rs:128–137  ·  view source on GitHub ↗

Calculates the offset from a device pointer. `count` is in units of T; eg. a `count` of 3 represents a pointer offset of `3 * size_of:: ()` bytes. # Safety If any of the following conditions are violated, the result is Undefined Behavior: Both the starting and resulting pointer must be either in bounds or one byte past the end of *the same* allocated object. The computed offset, **in bytes*

(self, count: isize)

Source from the content-addressed store, hash-verified

126 /// }
127 /// ```
128 pub unsafe fn offset(self, count: isize) -> Self
129 where
130 T: Sized,
131 {
132 let ptr = self.ptr + (count as usize * size_of::<T>()) as u64;
133 Self {
134 ptr,
135 marker: PhantomData,
136 }
137 }
138
139 /// Calculates the offset from a device pointer using wrapping arithmetic.
140 ///

Callers 6

addMethod · 0.80
subMethod · 0.80
struct_llfieldsFunction · 0.80
describe_enum_variantFunction · 0.80
prepare_enum_metadataFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected