Open
Description
Shorthand types that are generic over lane count:
type u32xN<const N: usize> = Simd<u32, N>;
type f32xN<const N: usize> = Simd<f32, N>;
type u64xN<const N: usize> = Simd<u64, N>;
type f64xN<const N: usize> = Simd<f64, N>;
// etc.
I've found it easier to write these compared to Simd<u32, N>
(which I find quite noisy).
And possibly the inverse, although not as useful(?):
type Tx1<T> = Simd<T, 1>;
type Tx2<T> = Simd<T, 2>;
type Tx4<T> = Simd<T, 4>;
type Tx8<T> = Simd<T, 8>;
// etc.
This would be used in code that is generic over lane count, for example:
fn multiply_add<const N: usize>(x: f32xN<N>, y: f32xN<N>, z: f32xN<N>) -> f32xN<N>
where LaneCount<N>: SupportedLaneCount
{
x * y + z
}