Trait Bytes
pub trait Bytes: Sized + Seal
Conversion of SIMD vectors to and from same-width vectors of u8 lanes.
Bytes::bitcast uses this byte representation to reinterpret any two
non-mask SIMD vectors with the same total width and SIMD token. This is a
bitwise reinterpretation: it does not perform numeric conversion.
Associated Types
type Bytes: Bytes<Bytes = Self::Bytes>;The same-width SIMD vector of
u8lanes used as the byte representation.This type is its own byte representation.
Required Methods
fn to_bytes(self) -> Self::BytesReinterpret this vector as a same-width vector of
u8lanes.fn from_bytes(value: Self::Bytes) -> SelfReinterpret a same-width vector of
u8lanes as this vector type.
Provided Methods
fn bitcast<U: Bytes<Bytes = Self::Bytes>>(self) -> UBitcast directly to another SIMD vector with the same byte representation. This is effectively a safe transmute for SIMD types.
This works in code generic over a
Simdimplementation, including between native-width vectors with different lane types:# use fearless_simd::prelude::*; fn i8s_as_f64s<S: Simd>(value: S::i8s) -> S::f64s { value.bitcast() }
Implementors
impl<S: Simd> Bytes for f32x16<S>impl<S: Simd> Bytes for f32x4<S>impl<S: Simd> Bytes for f32x8<S>impl<S: Simd> Bytes for f64x2<S>impl<S: Simd> Bytes for f64x4<S>impl<S: Simd> Bytes for f64x8<S>impl<S: Simd> Bytes for i16x16<S>impl<S: Simd> Bytes for i16x32<S>impl<S: Simd> Bytes for i16x8<S>impl<S: Simd> Bytes for i32x16<S>impl<S: Simd> Bytes for i32x4<S>impl<S: Simd> Bytes for i32x8<S>impl<S: Simd> Bytes for i64x2<S>impl<S: Simd> Bytes for i64x4<S>impl<S: Simd> Bytes for i64x8<S>impl<S: Simd> Bytes for i8x16<S>impl<S: Simd> Bytes for i8x32<S>impl<S: Simd> Bytes for i8x64<S>impl<S: Simd> Bytes for u16x16<S>impl<S: Simd> Bytes for u16x32<S>impl<S: Simd> Bytes for u16x8<S>impl<S: Simd> Bytes for u32x16<S>impl<S: Simd> Bytes for u32x4<S>impl<S: Simd> Bytes for u32x8<S>impl<S: Simd> Bytes for u64x2<S>impl<S: Simd> Bytes for u64x4<S>impl<S: Simd> Bytes for u64x8<S>impl<S: Simd> Bytes for u8x16<S>impl<S: Simd> Bytes for u8x32<S>impl<S: Simd> Bytes for u8x64<S>