avx.rs
SHA-25611d4a149007fde9f34168fa43b3cba700667782c987796dca8526564b3e01007
Malecule∅
Evidence
1use core::arch::x86_64::*;
2use core::cmp;
3use core::mem::size_of;
4
5use x86::sse2;
6
7const VECTOR_SIZE: usize = size_of::<__m256i>();
8const VECTOR_ALIGN: usize = VECTOR_SIZE - 1;
9
10// The number of bytes to loop at in one iteration of memchr/memrchr.
11const LOOP_SIZE: usize = 4 * VEC …
13:24… to loop at in one iteration of memchr2/memrchr2 and
14// memchr3/memrchr3. There was no observable difference between 128 and 64
15// bytes in benchmar …
20:25… u8, haystack: &[u8]) -> Option<usize> {
21 // For a high level explanation for how this algorithm works, see the
22 // sse2 implementation. The avx implementation here is the same, but with
23 // 256-bit vectors instead of 128-bit vectors.
24
25 let start_ptr = haystack.as_ptr();
26 …
629:63… significant byte
630 // is at a higher address. That means the least significant bit that is set
631 // corresponds to the position of our first mat …