Add as_slice/as_mut_slice to Vector
This commit is contained in:
parent
c077bf3c07
commit
f178dda187
@ -31,6 +31,11 @@ pub trait Vector: sealed::Sealed {
|
||||
#[must_use]
|
||||
fn splat(val: Self::Scalar) -> Self;
|
||||
|
||||
/// Returns a slice containing the entire SIMD vector.
|
||||
fn as_slice(&self) -> &[Self::Scalar];
|
||||
|
||||
/// Returns a mutable slice containing the entire SIMD vector.
|
||||
fn as_mut_slice(&mut self) -> &mut [Self::Scalar];
|
||||
}
|
||||
|
||||
macro_rules! impl_vector_for {
|
||||
@ -53,7 +58,17 @@ impl Vector for $simd<$lanes> {
|
||||
|
||||
#[inline]
|
||||
fn splat(val: Self::Scalar) -> Self {
|
||||
[val; $lanes].into()
|
||||
Self::splat(val)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn as_slice(&self) -> &[Self::Scalar] {
|
||||
self.as_slice()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn as_mut_slice(&mut self) -> &mut [Self::Scalar] {
|
||||
self.as_mut_slice()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user