SIMD for calculating checksum

SIMD for calculating checksum

Hi Experts,

Can we optimize following checksum calculation using SIMD somehow ?

for(int i = 0 ; i < buffSize_ ; i++) {
hashVal = (hashVal<<5) + hashVal + pBuffer_[i];
}

Thank you
Zooli

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Quoting zooliiHi Experts,

Can we optimize following checksum calculation using SIMD somehow ?

for(int i = 0 ; i < buffSize_ ; i++) {
hashVal = (hashVal<<5) + hashVal + pBuffer_[i];
}

Thank you
Zooli

Yes, with and without SSE. Also, you didn't specifytypes of'hashVal' and'pBuffer_'variables.

Best regards,
Sergey

Hi Sergy,Thanks for the reply. hashVal can be an unsigned int or long . pBuffer_ is an unsigned char array.RegardsZooli

You need to consider a set of SSE3 instructions for a horizontal addition.

Best regards,
Sergey

If the array is at all large, the vector sum reductions implemented by the compilers (nearly any compiler other than MSVC) may be superior.

Leave a Comment

Please sign in to add a comment. Not a member? Join today