dimforge / dimforge/simba

Add as_array to SimdValue?

Open
#66 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
347
Forks
39
PR merge metrics
No merged PRs in 30d

Description

Often it would be convenient to be able to cast the entire SIMD value to an array reference instead of extracting lanes one by one, in a generic code over any `SimdValue`.

As far as I can tell, all implementations of `SimdValue` should be able to support this - `AutoSimd<[T; N]>` has array easily accessed via `.0`, primitives can be casted via `std::slice::from_ref`, `num_complex::Complex` has `repr(C)` compatible with `[T; 2]`, `std::simd`-based implementation has its own `as_array`, and `wide`-based implementation has `as_array_ref`.

With that in mind, can we add `as_array` to `SimdValue` trait itself to make writing generic code easier?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.