i need to pre-increment a pointer to be 16B aligned for use with sse2 functions, but i am somewhat concerned about the repeated use of the modulus. i have heard it is possible to check for alignment with the & operator, but i can't seem to get that to work.
Code:
//...
unsigned char* index1 = memberDataBlock;
unsigned char* index2 = someOtherDataBlock;
while(index1%16||index2%16)
{
*index1++ |= *index2++;
}
//...
is there a faster way to achieve the condition above other than using the modulus? i don't need the actual remainder, i just need to know if there is one or not.
please feel free to move this to the C forum if it is deemed more appropriate