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
47
48
49
50
51
52
53
54
55
56
57
//! SIMD acceleration module for high-performance pattern matching.
//!
//! This module provides AVX2-accelerated string search routines with automatic
//! fallback to scalar implementations when AVX2 is not available.
//!
//! # Features
//!
//! - **memchr family**: Single-byte and multi-byte search (memchr, memchr2, memchr3, memrchr)
//! - **Teddy**: Multi-literal matcher using SIMD nibble hashing (up to 8 patterns)
//!
//! # Performance
//!
//! When AVX2 is available, these routines process 32 bytes per iteration, providing
//! significant speedup over scalar implementations for long haystacks.
//!
//! # Example
//!
//! ```
//! use regexr::simd::{memchr, Teddy};
//!
//! // Single byte search
//! let pos = memchr(b'x', b"hello world");
//! assert_eq!(pos, None);
//!
//! // Multi-literal search
//! let teddy = Teddy::new(vec![b"hello".to_vec(), b"world".to_vec()]).unwrap();
//! let (pattern_id, pos) = teddy.find(b"say hello there").unwrap();
//! assert_eq!(pattern_id, 0);
//! assert_eq!(pos, 4);
//! ```
pub use ;
pub use ;
/// Returns true if AVX2 SIMD instructions are available at runtime.
///
/// This checks the CPU features at runtime and returns true if AVX2 is supported.
/// When AVX2 is not available, all SIMD functions fall back to scalar implementations.