You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the blog post about fast byte counting and I was reading through the code to better understand the SIMD intrinsic. I was mostly able to follow along but I got confused at this part
I don't understand why we are subtracting the results of the compare instead of adding them. It seems like this will give incorrect results, but obviously doesn't, and I can't explain why. Could someone explain it to me?
The text was updated successfully, but these errors were encountered:
The reason for that is that the result of _mm256_cmpeq_epi8 is either all 1s or all 0s. And an i8 with all 1s is -1. So we need to subtract that to add 1 wherever the byte is equal.
I read the blog post about fast byte counting and I was reading through the code to better understand the SIMD intrinsic. I was mostly able to follow along but I got confused at this part
bytecount/src/simd/x86_avx2.rs
Lines 58 to 61 in 5085205
I don't understand why we are subtracting the results of the compare instead of adding them. It seems like this will give incorrect results, but obviously doesn't, and I can't explain why. Could someone explain it to me?
The text was updated successfully, but these errors were encountered: