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

Method wrapping_add

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

Calculates the offset from a pointer using wrapping arithmetic. (convenience for `.wrapping_offset(count as isize)`) `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. Always use `.add(count)` instead when possible, because `add` al

(self, count: usize)

Source from the content-addressed store, hash-verified

287 /// }
288 /// ```
289 pub fn wrapping_add(self, count: usize) -> Self
290 where
291 T: Sized,
292 {
293 self.wrapping_offset(count as isize)
294 }
295
296 /// Calculates the offset from a pointer using wrapping arithmetic.
297 /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`)

Callers 9

wrapping_offsetMethod · 0.80
range_metadataMethod · 0.80
next_u32Method · 0.80
next_u32Method · 0.80
next_u64Method · 0.80
next_u64Method · 0.80
next_u64Method · 0.80
next_u64Method · 0.80

Calls 1

wrapping_offsetMethod · 0.80

Tested by

no test coverage detected