1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use core::arch::x86_64::__m256i;
use crate::memmem::{
prefilter::{PrefilterFnTy, PrefilterState},
NeedleInfo,
};
const _: PrefilterFnTy = find;
#[target_feature(enable = "avx2")]
pub(crate) unsafe fn find(
prestate: &mut PrefilterState,
ninfo: &NeedleInfo,
haystack: &[u8],
needle: &[u8],
) -> Option<usize> {
super::super::genericsimd::find::<__m256i>(
prestate,
ninfo,
haystack,
needle,
super::sse::find,
)
}
#[cfg(test)]
mod tests {
#[test]
#[cfg(not(miri))]
fn prefilter_permutations() {
use crate::memmem::prefilter::tests::PrefilterTest;
if !is_x86_feature_detected!("avx2") {
return;
}
unsafe { PrefilterTest::run_all_tests(super::find) };
}
}