use crate::f16::panic_f16_feature_disabled;
use crate::{
f16::F16,
- ieee754::FloatEncoding,
- scalar,
+ prim::PrimFloat,
traits::{
Bool, Compare, Context, ConvertFrom, ConvertTo, Float, Int, Make, SInt, Select, UInt,
},
};
}
-macro_rules! impl_uint_vector {
- ($ty:ident) => {
- impl_int_vector!($ty);
- impl<const LANES: usize> UInt for Wrapper<$ty<LANES>, LANES>
+macro_rules! impl_uint_sint_vector {
+ ($uint:ident, $sint:ident) => {
+ impl_int_vector!($uint);
+ impl_int_vector!($sint);
+ impl<const LANES: usize> UInt for Wrapper<$uint<LANES>, LANES>
where
SimdI8<LANES>: LanesAtMost32,
SimdU8<LANES>: LanesAtMost32,
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
+ type PrimUInt = Self::Prim;
+ type SignedType = Wrapper<$sint<LANES>, LANES>;
}
- };
-}
-impl_uint_vector!(SimdU8);
-impl_uint_vector!(SimdU16);
-impl_uint_vector!(SimdU32);
-impl_uint_vector!(SimdU64);
-
-macro_rules! impl_uint_scalar {
- ($ty:ident) => {
- impl_int_scalar!($ty);
- impl<const LANES: usize> UInt for Wrapper<$ty, LANES>
+ impl<const LANES: usize> SInt for Wrapper<$sint<LANES>, LANES>
where
SimdI8<LANES>: LanesAtMost32,
SimdU8<LANES>: LanesAtMost32,
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
+ type PrimSInt = Self::Prim;
+ type UnsignedType = Wrapper<$uint<LANES>, LANES>;
}
};
}
-impl_uint_scalar!(u8);
-impl_uint_scalar!(u16);
-impl_uint_scalar!(u32);
-impl_uint_scalar!(u64);
+impl_uint_sint_vector!(SimdU8, SimdI8);
+impl_uint_sint_vector!(SimdU16, SimdI16);
+impl_uint_sint_vector!(SimdU32, SimdI32);
+impl_uint_sint_vector!(SimdU64, SimdI64);
-macro_rules! impl_sint_vector {
- ($ty:ident) => {
- impl_int_vector!($ty);
- impl<const LANES: usize> SInt for Wrapper<$ty<LANES>, LANES>
+macro_rules! impl_uint_sint_scalar {
+ ($uint:ident, $sint:ident) => {
+ impl_int_scalar!($uint);
+ impl_int_scalar!($sint);
+ impl<const LANES: usize> UInt for Wrapper<$uint, LANES>
where
SimdI8<LANES>: LanesAtMost32,
SimdU8<LANES>: LanesAtMost32,
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
+ type PrimUInt = Self::Prim;
+ type SignedType = Wrapper<$sint, LANES>;
}
- };
-}
-impl_sint_vector!(SimdI8);
-impl_sint_vector!(SimdI16);
-impl_sint_vector!(SimdI32);
-impl_sint_vector!(SimdI64);
-
-macro_rules! impl_sint_scalar {
- ($ty:ident) => {
- impl_int_scalar!($ty);
- impl<const LANES: usize> SInt for Wrapper<$ty, LANES>
+ impl<const LANES: usize> SInt for Wrapper<$sint, LANES>
where
SimdI8<LANES>: LanesAtMost32,
SimdU8<LANES>: LanesAtMost32,
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
+ type PrimSInt = Self::Prim;
+ type UnsignedType = Wrapper<$uint, LANES>;
}
};
}
-impl_sint_scalar!(i8);
-impl_sint_scalar!(i16);
-impl_sint_scalar!(i32);
-impl_sint_scalar!(i64);
+impl_uint_sint_scalar!(u8, i8);
+impl_uint_sint_scalar!(u16, i16);
+impl_uint_sint_scalar!(u32, i32);
+impl_uint_sint_scalar!(u64, i64);
macro_rules! impl_float {
($ty:ident, $prim:ident, $uint:ident, $sint:ident) => {
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
- type FloatEncoding = $prim;
+ type PrimFloat = $prim;
- type BitsType = Wrapper<<$prim as FloatEncoding>::BitsType, LANES>;
+ type BitsType = Wrapper<<$prim as PrimFloat>::BitsType, LANES>;
- type SignedBitsType = Wrapper<<$prim as FloatEncoding>::SignedBitsType, LANES>;
+ type SignedBitsType = Wrapper<<$prim as PrimFloat>::SignedBitsType, LANES>;
fn abs(self) -> Self {
self.0.abs().into()
#[cfg(feature = "fma")]
fn fma(self, a: Self, b: Self) -> Self {
- let a = scalar::Value(a.0);
- let b = scalar::Value(b.0);
- scalar::Value(self.0).fma(a, b).0.into()
+ use crate::scalar::Value;
+ let a = Value(a.0);
+ let b = Value(b.0);
+ Value(self.0).fma(a, b).0.into()
}
fn is_finite(self) -> Self::Bool {
SimdF64<LANES>: LanesAtMost32,
Mask64<LANES>: Mask,
{
- type FloatEncoding = $prim;
+ type PrimFloat = $prim;
type BitsType = Wrapper<$uint<LANES>, LANES>;