How can I use SIMD to accelerate XOR two blocks of memory?

后端 未结 3 1261
心在旅途
心在旅途 2021-01-12 14:09

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         


        
3条回答
  •  误落风尘
    2021-01-12 14:30

    Okay, if intels prefer going forward and prefer pointer ops over indexes, then:

    void region_xor_w64(unsigned char *r1, unsigned char *r2, unsigned int i)
    {
        while (i--)
            *r2++ ^= *r1++;
    }
    

    Mike

提交回复
热议问题