pub const unsafe fn atomic_xadd<T: Copy, U: Copy, const ORD: AtomicOrdering>(
dst: *mut T,
src: U,
) -> T🔬This is a nightly-only experimental API. (
core_intrinsics)Expand description
Adds to the current value, returning the previous value.
T must be an integer or pointer type.
U must be the same as T if that is an integer type, or usize if T is a pointer type.
§Safety
-
If
Tis an integer type, this is equivalent toAtomic<T>::from_ptrfollowed byAtomic<T>::fetch_add. Refer to the documentation ofAtomic<T>::from_ptrfor safety requirements. -
If
Tis a pointer type, this is equivalent toAtomicPtr<P>::from_ptrfollowed byAtomicPtr<P>::fetch_byte_add, wherePis the pointee type of the pointer. Refer to the documentation ofAtomicPtr<P>::from_ptrfor safety requirements.
The stabilized version of this intrinsic is available on the
atomic types via the fetch_add method. For example, AtomicIsize::fetch_add.