1.27.0[−][src]Function core::arch::x86::_mm256_shuffle_epi8
pub unsafe fn _mm256_shuffle_epi8(a: __m256i, b: __m256i) -> __m256i
This is supported on x86 and target feature
avx2
only.Shuffles bytes from a
according to the content of b
.
The last 4 bits of each byte of b
are used as addresses into the 32 bytes
of a
.
In addition, if the highest significant bit of a byte of b
is set, the
respective destination byte is set to 0.
The low and high halves of the vectors are shuffled separately.
Picturing a
and b
as [u8; 32]
, _mm256_shuffle_epi8
is logically
equivalent to:
fn mm256_shuffle_epi8(a: [u8; 32], b: [u8; 32]) -> [u8; 32] { let mut r = [0; 32]; for i in 0..16 { // if the most significant bit of b is set, // then the destination byte is set to 0. if b[i] & 0x80 == 0u8 { r[i] = a[(b[i] % 16) as usize]; } if b[i + 16] & 0x80 == 0u8 { r[i + 16] = a[(b[i + 16] % 16 + 16) as usize]; } } r }Run