Original Post
Hello,
I am using integers as bit containers representing bool values.
How do I make a fast instruction that reads some bit from one integer and sets its value to another.
Lets say: there are two 64 bit integers. One of them x has some bits set.
I want to rewrite every second bit from x to y (from beginning). How do I make that avoiding code similar to that:
I mean I want to avoid if instruction.
Regards.
I am using integers as bit containers representing bool values.
How do I make a fast instruction that reads some bit from one integer and sets its value to another.
Lets say: there are two 64 bit integers. One of them x has some bits set.
I want to rewrite every second bit from x to y (from beginning). How do I make that avoiding code similar to that:
y=0; //clear y
t=0;
for (int i=0;i<64;i+=2)
if (x & (CONTAINER_INT(1) << (i%ContainerSize)))
{
y |= CONTAINER_INT(1) << (t%ContainerSize);
t++;
}
I mean I want to avoid if instruction.
Regards.