Sha256: daa648fc2a90d37299803a80d632e8a47a30ce8719d0ac2a2ea2cde3b30b6fef

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

use core::arch::x86_64::__m128i;

use crate::memmem::{
    prefilter::{PrefilterFnTy, PrefilterState},
    NeedleInfo,
};

// Check that the functions below satisfy the Prefilter function type.
const _: PrefilterFnTy = find;

/// An SSE2 accelerated candidate finder for single-substring search.
///
/// # Safety
///
/// Callers must ensure that the sse2 CPU feature is enabled in the current
/// environment. This feature should be enabled in all x86_64 targets.
#[target_feature(enable = "sse2")]
pub(crate) unsafe fn find(
    prestate: &mut PrefilterState,
    ninfo: &NeedleInfo,
    haystack: &[u8],
    needle: &[u8],
) -> Option<usize> {
    super::super::genericsimd::find::<__m128i>(
        prestate,
        ninfo,
        haystack,
        needle,
        super::super::simple_memchr_fallback,
    )
}

#[cfg(all(test, feature = "std"))]
mod tests {
    #[test]
    #[cfg(not(miri))]
    fn prefilter_permutations() {
        use crate::memmem::prefilter::tests::PrefilterTest;
        // SAFETY: super::find is safe to call for all inputs on x86.
        unsafe { PrefilterTest::run_all_tests(super::find) };
    }
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wasmtime-13.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-12.0.1 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-12.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-11.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-10.0.1 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-10.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-9.0.4 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-9.0.1 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-8.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-7.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-6.0.1 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-6.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-5.0.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-0.4.1 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs
wasmtime-0.4.0 ./ext/cargo-vendor/memchr-2.5.0/src/memmem/prefilter/x86/sse.rs