ndcopy

Crates.iondcopy
lib.rsndcopy
version0.3.0
sourcesrc
created_at2021-09-28 20:17:55.530487
updated_at2022-04-17 23:30:53.380705
descriptionFast N-dimensional array memcpy
homepage
repositoryhttps://github.com/bonsairobo/ndcopy-rs
max_upload_size
id457745
size26,537
Duncan (bonsairobo)

documentation

README

ndcopy

Fast N-dimensional array memcpy.

Speed is achieved by copying slices row-by-row. Rust code is much faster at copying slices than trying to index N-dimensional coordinates for every value index.

Example Code

use ndcopy::ndshape::{ConstShape, ConstShape3u32};
use ndcopy::copy3;

type SrcShape = ConstShape3u32<50, 50, 50>;
type DstShape = ConstShape3u32<25, 25, 25>;
let src = [1u8; SrcShape::USIZE];
let mut dst = [0u8; DstShape::USIZE];

let copy_shape = [20; 3];
let src_min = [1, 2, 3];
let dst_min = [2, 3, 4];
copy3(
    copy_shape,
    &src,
    &SrcShape {},
    src_min,
    &mut dst,
    &DstShape {},
    dst_min,
);

License: MIT OR Apache-2.0

Commit count: 10

cargo fmt