pub unsafe fn well_defined_copy_from<const SYNC_OPT: u8, const WORST_CASE_ALIGNMENT: usize>(
dst: *mut u8,
src: *const u8,
size_bytes: usize,
)Expand description
Copy size_bytes bytes from src to dst using atomic load operations to load the
element from src so that the behavior of the system is always well defined,
even if there is a well_defined_copy_to operation writing to the memory pointed
to by src concurrent with this well_defined_copy_from operation.
well_defined_copy_from has memcpy semantics, not memmove semantics. In other
words, it is illegal for src or dst to overlap in any way.
While it is not required, by default, that src and dst have any specific
alignment, both src and dst must have the same alignment.
IOW: (src & 0x7) must equal (dst & 0x7)
§Const Generic Args
SYNC_OPT
Controls the options for memory order synchronization. See the comments on
crate::common::SyncOpt for details.
WORST_CASE_ALIGNMENT
An explicit guarantee of the worst case alignment that src/dst will obey.
When this alignment guarantee is greater than or equal to the maximum
internal transfer granularity of 64 bits, the initial explicit alignment step
of the operation can be optimized away for a minor performance gain.
§Safety
srcanddstmust be valid for reads and writes (respectively) ofsize_bytesbytes, must not overlap, and must have the same alignment modulo 8.- Both pointers must be aligned to at least
WORST_CASE_ALIGNMENT. srcmust only be accessed concurrently through well-defined copy operations, anddstmust not be concurrently accessed.