W3cubDocs

/Rust

Function std::intrinsics::arith_offset

pub unsafe extern "rust-intrinsic" fn arith_offset<T>(dst: *const T,                                                      offset: isize)                                                      -> *const T
🔬 This is a nightly-only experimental API. (core_intrinsics)intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library

Calculates the offset from a pointer, potentially wrapping.

This is implemented as an intrinsic to avoid converting to and from an integer, since the conversion inhibits certain optimizations.

Safety

Unlike the offset intrinsic, this intrinsic does not restrict the resulting pointer to point into or one byte past the end of an allocated object, and it wraps with two's complement arithmetic. The resulting value is not necessarily valid to be used to actually access memory.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/intrinsics/fn.arith_offset.html