Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Compare 16 byte strings with SSE

$
0
0

I have 16 byte 'strings' (they may be shorter but you may assume that they are padded with zeros at the end), but you may not assume they are 16 byte aligned (at least not always).

How to write a routine that will compare them (for equality) with SSE intrinsics? I found this code fragment that could be of help but I', not sure if it is appropriate?

register __m128i xmm0, xmm1; register unsigned int eax; xmm0 = _mm_load_epi128((__m128i*)(a)); xmm1 = _mm_load_epi128((__m128i*)(b)); xmm0 = _mm_cmpeq_epi8(xmm0, xmm1); eax = _mm_movemask_epi8(xmm0); if(eax==0xffff) //equal else   //not equal 

Could someone explain this or write a function body?

It needs to work in GCC/mingw (on 32 bit Windows).


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>