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

Method wrapping_sub

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

Calculates the offset from a pointer using wrapping arithmetic. (convenience for `.wrapping_offset((count as isize).wrapping_sub())`) `count` is in units of T; e.g. a `count` of 3 represents a pointer offset of `3 * size_of:: ()` bytes. # Safety The resulting pointer does not need to be in bounds, but it is potentially hazardous to dereference (which requires `unsafe`). Always use `.sub(coun

(self, count: usize)

Source from the content-addressed store, hash-verified

319 /// }
320 /// ```
321 pub fn wrapping_sub(self, count: usize) -> Self
322 where
323 T: Sized,
324 {
325 self.wrapping_offset((count as isize).wrapping_neg())
326 }
327
328 /// Casts this device pointer to another type.
329 pub fn cast<U: DeviceCopy>(self) -> DevicePointer<U> {

Callers 1

Calls 1

wrapping_offsetMethod · 0.80

Tested by

no test coverage detected