A piece of C++ code determines the occurances of zero and
keeps a binary flag variable for each number that is checked. The value of the flag
toggles between 0 and 1 each time a zero is encountered in a 1 dimensional array.
I am attempting to use SSE to speed it up, but
I am unsure of how to go about this. Evaluating the individual fields of __m128i is
inefficient, I've read.
The code in C++
is:
int flag =
0;
int var_num2[1000];
for(int i = 0; i<1000; i++)
{
if (var[i] == 0)
{
var_num2[i] = flag;
flag
= !flag; //toggle value upon encountering a 0
}
}
How
should I go about this using SSE intrinsics?
No comments:
Post a Comment