Skip to content

Commit

Permalink
Inline Index and IndexMut implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Dec 19, 2024
1 parent 6c13d52 commit ba9bfd9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/overloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@ macro_rules! impl_simd_base_overloads {
impl Index<usize> for $s {
type Output = <Self as SimdConsts>::Scalar;

#[inline(always)]
fn index(&self, index: usize) -> &Self::Output {
unsafe { &(*self.transmute_into_array_ref())[index] }
}
}

impl IndexMut<usize> for $s {
#[inline(always)]
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
unsafe { &mut (*self.transmute_into_array_mut())[index] }
}
Expand Down

0 comments on commit ba9bfd9

Please sign in to comment.