MCPcopy Index your code
hub / github.com/RustPython/RustPython / raw_ptr_add

Function raw_ptr_add

crates/common/src/boxvec.rs:574–581  ·  view source on GitHub ↗

Rawptr add but uses arithmetic distance for ZST

(ptr: *mut T, offset: usize)

Source from the content-addressed store, hash-verified

572
573/// Rawptr add but uses arithmetic distance for ZST
574unsafe fn raw_ptr_add<T>(ptr: *mut T, offset: usize) -> *mut T {
575 if mem::size_of::<T>() == 0 {
576 // Special case for ZST
577 (ptr as usize).wrapping_add(offset) as _
578 } else {
579 unsafe { ptr.add(offset) }
580 }
581}
582
583unsafe fn raw_ptr_write<T>(ptr: *mut T, value: T) {
584 if mem::size_of::<T>() == 0 {

Callers 1

extendMethod · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected