![Latest Version] ![Travis-CI Status] ![docs] ![MIT]

In One Sentence

You want to use std::simd but realized there is no simple, safe and fast way to align your f32x8 (and friends) in memory and treat them as regular f32 slices for easy loading and manipulation; simd_aligned to the rescue.

Highlights

Note: Right now this is an experimental crate. Features might be added or removed depending on how std::simd evolves. At the end of the day it's just about being able to load and manipulate data without much fuzz.

Examples

Produces a vector that can hold 10 elements of type f64. Might internally allocate 5 elements of type f64x2, or 3 of type f64x4, depending on the platform. All elements are guaranteed to be properly aligned for fast access.

```rust use packedsimd::*; use simdaligned::*;

// Create vectors of 10 f64 elements with value 0.0. let mut v1 = VectorD::::with(0.0, 10); let mut v2 = VectorD::::with(0.0, 10);

// Get "flat", mutable view of the vector, and set individual elements: let v1m = v1.flatmut(); let v2m = v2.flatmut();

// Set some elements on v1 v1m[0] = 0.0; v1m[4] = 4.0; v1_m[8] = 8.0;

// Set some others on v2 v2m[1] = 0.0; v2m[5] = 5.0; v2_m[9] = 9.0;

let mut sum = f64s::splat(0.0);

// Eventually, do something with the actual SIMD types. Does // std::simd vector math, e.g., f64x8 + f64x8 in one operation: sum = v1[0] + v2[0]; ```

Benchmarks

There is no performance penalty for using simd_aligned, while retaining all the simplicity of handling flat arrays.

test vectors::packed ... bench: 202 ns/iter (+/- 3) test vectors::scalar ... bench: 1,586 ns/iter (+/- 85) test vectors::simd_aligned ... bench: 201 ns/iter (+/- 10)

Status

FAQ

How does it relate to faster and std::simd?