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

Function npyv_lut32_f32

numpy/core/src/common/simd/sse/memory.h:723–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721// uses vector as indexes into a table
722// that contains 32 elements of float32.
723NPY_FINLINE npyv_f32 npyv_lut32_f32(const float *table, npyv_u32 idx)
724{
725 const int i0 = _mm_cvtsi128_si32(idx);
726#ifdef NPY_HAVE_SSE41
727 const int i1 = _mm_extract_epi32(idx, 1);
728 const int i2 = _mm_extract_epi32(idx, 2);
729 const int i3 = _mm_extract_epi32(idx, 3);
730#else
731 const int i1 = _mm_extract_epi16(idx, 2);
732 const int i2 = _mm_extract_epi16(idx, 4);
733 const int i3 = _mm_extract_epi16(idx, 6);
734#endif
735 return npyv_set_f32(table[i0], table[i1], table[i2], table[i3]);
736}
737NPY_FINLINE npyv_u32 npyv_lut32_u32(const npy_uint32 *table, npyv_u32 idx)
738{ return npyv_reinterpret_u32_f32(npyv_lut32_f32((const float*)table, idx)); }
739NPY_FINLINE npyv_s32 npyv_lut32_s32(const npy_int32 *table, npyv_u32 idx)

Callers 2

npyv_lut32_u32Function · 0.70
npyv_lut32_s32Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected