__m128* pSrc1 = (__m128*) string;
__m128 m0 = _mm_set_ps1(0); //null character
while(1)
{
__m128 result = __m128 _mm_cmpeq_ss(*pSrc1, m0);
//if character is \0 then break
//do some stuff here
pSrc1++;
}
I have a string whose length can be a multiple of 16.
How do I break out of the loop if _mm_cmpeq_ss returns equal?
If you’re trying to break out of the loop when you first encounter a
\0then you’ll need to do something like this:If you only want to test for
\0characters in certain positions and ignore any others then you can change theif (vmask != 0)test to something which matches your specific requirements.