start adding stdsimd support
[vector-math.git] / src / stdsimd.rs
1 use crate::{f16::F16, traits::Context};
2 use core::marker::PhantomData;
3 use core_simd::SimdF32;
4
5 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)]
6 pub struct StdSimd<const LANES: usize>(PhantomData<[(); LANES]>);
7
8 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)]
9 pub struct Scalar<T, const LANES: usize>(pub T, PhantomData<[(); LANES]>);
10
11 impl<T, const LANES: usize> From<T> for Scalar<T, LANES> {
12 fn from(v: T) -> Self {
13 Scalar(v, PhantomData)
14 }
15 }
16
17 /*
18 TODO(programmerjake): finish after splitting Context::VecBool
19 impl<const LANES: usize> Context for StdSimd<LANES> {
20 type Bool = Scalar<bool>;
21 type U8 = Scalar<u8>;
22 type I8 = Scalar<i8>;
23 type U16 = Scalar<u16>;
24 type I16 = Scalar<i16>;
25 type F16 = Scalar<F16>;
26 type U32 = Scalar<u32>;
27 type I32 = Scalar<i32>;
28 type F32 = Scalar<f32>;
29 type U64 = Scalar<u64>;
30 type I64 = Scalar<i64>;
31 type F64 = Scalar<f64>;
32 type VecBool;
33 type VecU8;
34 type VecI8;
35 type VecU16;
36 type VecI16;
37 type VecF16;
38 type VecU32;
39 type VecI32;
40 type VecF32;
41 type VecU64;
42 type VecI64;
43 type VecF64;
44 }
45 */