I want to XOR two blocks of memory as quickly as possible, How can I use SIMD to accelerate it?
My original code is below:
void region_xor_w64( uns
As the size of the region is passed by value why wouldn't the code be:
void region_xor_w64(unsigned char *r1, unsigned char *r2, unsigned int i)
{
while (i--)
r2[i] = r1[i] ^ r2[i];
}
or even:
void region_xor_w64(unsigned char *r1, unsigned char *r2, unsigned int i)
{
while (i--)
r2[i] ^= r1[i];
}
If there's a preference towards going forwards ('up memory') and for using pointers, then:
void region_xor_w64(unsigned char *r1, unsigned char *r2, unsigned int i)
{
while (i--)
*r2++ ^= *r1++;
}