MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / copy_backwards

Function copy_backwards

publication/code/chapter07/tim_sort.rs:404–410  ·  view source on GitHub ↗

数据直接拷贝放回,可能有重叠

(src: *const i32, dest: *mut i32, size: usize)

Source from the content-addressed store, hash-verified

402
403// 数据直接拷贝放回,可能有重叠
404unsafe fn copy_backwards(src: *const i32, dest: *mut i32, size: usize) {
405 ptr::copy(
406 src.offset(-(size as isize - 1)),
407 dest.offset(-(size as isize)),
408 size,
409 );
410}
411
412// 数据直接拷贝放回,无重叠
413unsafe fn copy_nonoverlapping_backwards(src: *const i32, dest: *mut i32, size: usize) {

Callers 1

mergeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected