Skip to content

Commit da69c54

Browse files
authored
Clarify _mm256_shuffle_epi8 documentation (#990)
The old documentation seemed to suggest that the low 4 bits of bytes in `b` would index into the 32-element array `a`. That's not quite right and you'd need 5 bits to index 32 elements.
1 parent 67d3e6a commit da69c54

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/core_arch/src/x86/avx2.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,14 +2587,13 @@ pub unsafe fn _mm256_sad_epu8(a: __m256i, b: __m256i) -> __m256i {
25872587

25882588
/// Shuffles bytes from `a` according to the content of `b`.
25892589
///
2590-
/// The last 4 bits of each byte of `b` are used as addresses into the 32 bytes
2591-
/// of `a`.
2590+
/// For each of the 128-bit low and high halves of the vectors, the last
2591+
/// 4 bits of each byte of `b` are used as addresses into the respective
2592+
/// low or high 16 bytes of `a`. That is, the halves are shuffled separately.
25922593
///
25932594
/// In addition, if the highest significant bit of a byte of `b` is set, the
25942595
/// respective destination byte is set to 0.
25952596
///
2596-
/// The low and high halves of the vectors are shuffled separately.
2597-
///
25982597
/// Picturing `a` and `b` as `[u8; 32]`, `_mm256_shuffle_epi8` is logically
25992598
/// equivalent to:
26002599
///

0 commit comments

Comments
 (0)