MCPcopy Create free account
hub / github.com/defold/defold / shuffle_epi8

Function shuffle_epi8

engine/dlib/src/basis/encoder/cppspmd_sse.h:235–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233
234#if CPPSPMD_SSE2
235inline __m128i shuffle_epi8(const __m128i& a, const __m128i& b)
236{
237 // Just emulate _mm_shuffle_epi8. This is very slow, but what else can we do?
238 CPPSPMD_ALIGN(16) uint8_t av[16];
239 _mm_store_si128((__m128i*)av, a);
240
241 CPPSPMD_ALIGN(16) uint8_t bvi[16];
242 _mm_store_ps((float*)bvi, _mm_and_ps(_mm_castsi128_ps(b), _mm_castsi128_ps(_mm_set1_epi32(0x0F0F0F0F))));
243
244 CPPSPMD_ALIGN(16) uint8_t result[16];
245
246 result[0] = av[bvi[0]];
247 result[1] = av[bvi[1]];
248 result[2] = av[bvi[2]];
249 result[3] = av[bvi[3]];
250
251 result[4] = av[bvi[4]];
252 result[5] = av[bvi[5]];
253 result[6] = av[bvi[6]];
254 result[7] = av[bvi[7]];
255
256 result[8] = av[bvi[8]];
257 result[9] = av[bvi[9]];
258 result[10] = av[bvi[10]];
259 result[11] = av[bvi[11]];
260
261 result[12] = av[bvi[12]];
262 result[13] = av[bvi[13]];
263 result[14] = av[bvi[14]];
264 result[15] = av[bvi[15]];
265
266 return _mm_andnot_si128(_mm_cmplt_epi8(b, _mm_setzero_si128()), _mm_load_si128((__m128i*)result));
267}
268#else
269CPPSPMD_FORCE_INLINE __m128i shuffle_epi8(const __m128i& a, const __m128i& b)
270{

Callers 5

byteswapFunction · 0.85
table_lookup4_8Function · 0.85
table_lookup5_8Function · 0.85
table_lookup6_8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected