We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd9c72a commit 0b311dcCopy full SHA for 0b311dc
1 file changed
include/xsimd/arch/xsimd_avx2.hpp
@@ -314,10 +314,9 @@ namespace xsimd
314
{
315
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
316
317
- const __m256i byte_mask = _mm256_set1_epi16(0x00FF);
318
- __m256i u16 = _mm256_and_si256(self, byte_mask);
319
- __m256i r16 = _mm256_srli_epi16(u16, shift);
320
- return _mm256_and_si256(r16, byte_mask);
+ constexpr uint8_t mask8 = static_cast<uint8_t>((1u << shift) - 1u);
+ __m256i const mask = _mm256_set1_epi8(mask8);
+ return _mm256_and_si256(_mm256_srli_epi16(self, shift), mask);
321
}
322
XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
323
@@ -331,10 +330,6 @@ namespace xsimd
331
330
332
return _mm256_srli_epi64(self, shift);
333
334
- else
335
- {
336
- return bitwise_rshift<shift>(self, avx {});
337
- }
338
339
340
0 commit comments