2 ms·
You handle multiple bytes at once; it's fractional on average. He's using vectorized operations to handle 16 bytes at a time, basically: __m128i has_error
by mcguire 9y ago
You handle multiple bytes at once; it's fractional on average.
He's using vectorized operations to handle 16 bytes at a time, basically:
__m128i has_error = _mm_setzero_si128();
__m128i zero = _mm_setzero_si128();
for (...) {
__m128i current_bytes = _mm_loadu_si128(src);
has_error =
_mm_or_si128(has_error, _mm_cmpgt_epi8(zero,current_bytes));
}
return _mm_testz_si128(has_error, has_error);
Each of the _mm* "functions" becomes 1 (?) vector instruction.