c++ - Extract 4 SSE integers to 4 chars -
suppose have __m128i
containing 4 32-bit integer values.
is there way can store inside char[4]
, lower char each int
value stored in char
value?
desired result:
r1 r2 r3 r4 __m128i 0x00000012 0x00000034 0x00000056 0x00000078 | v char[4] 0x12 0x34 0x56 0x78
sse2 , below preferred. compiling on msvc++.
with sse2 can use following code:
char[4] array; x = _mm_packs_epi32(x, x); x = _mm_packus_epi16(x, x); *((int*)array) = _mm_cvtsi128_si32(x);
Comments
Post a Comment