MCPcopy Create free account
hub / github.com/numpy/numpy / npyv_divc_s8

Function npyv_divc_s8

numpy/core/src/common/simd/avx2/arithmetic.h:95–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93// divide each signed 8-bit element by a precomputed divisor (round towards zero)
94NPY_FINLINE npyv_s16 npyv_divc_s16(npyv_s16 a, const npyv_s16x3 divisor);
95NPY_FINLINE npyv_s8 npyv_divc_s8(npyv_s8 a, const npyv_s8x3 divisor)
96{
97 const __m256i bmask = _mm256_set1_epi32(0x00FF00FF);
98 // instead of _mm256_cvtepi8_epi16/_mm256_packs_epi16 to wrap around overflow
99 __m256i divc_even = npyv_divc_s16(_mm256_srai_epi16(_mm256_slli_epi16(a, 8), 8), divisor);
100 __m256i divc_odd = npyv_divc_s16(_mm256_srai_epi16(a, 8), divisor);
101 divc_odd = _mm256_slli_epi16(divc_odd, 8);
102 return _mm256_blendv_epi8(divc_odd, divc_even, bmask);
103}
104// divide each unsigned 16-bit element by a precomputed divisor
105NPY_FINLINE npyv_u16 npyv_divc_u16(npyv_u16 a, const npyv_u16x3 divisor)
106{

Callers

nothing calls this directly

Calls 1

npyv_divc_s16Function · 0.70

Tested by

no test coverage detected