Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ where

let lo = shifted.cast::<u8>();
let hi = (shifted >> Simd::splat(8)).cast::<u8>();
let decoded_chunks = lo | hi.rotate_lanes_left::<1>();
let decoded_chunks = lo | hi.rotate_elements_left::<1>();

let output = swizzle!(N; decoded_chunks, array!(N; |i| i + i / 3));

Expand All @@ -158,7 +158,7 @@ where

// Note that we also need to undo the rotate we did to `hi`.
let lo = data & mask;
let hi = (data & !mask).rotate_lanes_right::<1>();
let hi = (data & !mask).rotate_elements_right::<1>();

// Interleave the shuffled pieces and undo the shift.
let shifted = lo.cast::<u16>() | (hi.cast::<u16>() << Simd::splat(8));
Expand Down
10 changes: 5 additions & 5 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ macro_rules! swizzle {
($N:ident; $x:expr, $index:expr) => {{
use std::simd::*;
struct Swz;
impl<const $N: usize> Swizzle2<$N, $N> for Swz
impl<const $N: usize> Swizzle<$N> for Swz
where
LaneCount<$N>: SupportedLaneCount,
{
const INDEX: [Which; $N] = {
const INDEX: [usize; $N] = {
let index = $index;
array!($N; |i| {
let i = index[i];
if i >= $N {
Which::Second(0)
$N
} else {
Which::First(i)
i
}
})
};
}

Swz::swizzle2($x, Simd::splat(0))
Swz::concat_swizzle($x, Simd::splat(0))
}};
}