MCPcopy Create free account
hub / github.com/Axect/Peroxide / copy_vec_ptr

Function copy_vec_ptr

src/util/low_level.rs:9–17  ·  view source on GitHub ↗

Copy each value from `src` through the corresponding pointer in `dst`. # Safety `dst` and `src` must have equal length (enforced by debug assert). Every pointer in `dst` must be valid for writes of `T` and properly aligned. Aliased pointers within `dst` produce undefined behaviour. No concurrent reader may access the locations written through `dst`.

(dst: &mut [*mut T], src: &[T])

Source from the content-addressed store, hash-verified

7/// aligned. Aliased pointers within `dst` produce undefined behaviour.
8/// * No concurrent reader may access the locations written through `dst`.
9pub unsafe fn copy_vec_ptr<T>(dst: &mut [*mut T], src: &[T])
10where
11 T: Copy,
12{
13 assert_eq!(dst.len(), src.len(), "Should use same length vectors");
14 for (&mut p, &s) in dst.iter_mut().zip(src) {
15 *p = s;
16 }
17}
18
19/// Pairwise-swap the values pointed to by `lhs` and `rhs`.
20///

Callers 2

solve_matMethod · 0.85
solve_matMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected