# 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.

Shuffle 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

Intel's documentation

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)