pub mod dispatch;
pub mod scalar;
#[cfg(target_arch = "x86_64")]
pub mod sse42;
#[cfg(target_arch = "x86_64")]
pub mod avx2;
#[cfg(target_arch = "aarch64")]
pub mod neon;
pub const DELIMITERS: [u8; 7] = [b'<', b'>', b'&', b'"', b'\'', b'=', b'/'];
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DelimiterResult {
Found {
pos: usize,
byte: u8,
},
NotFound,
}
impl DelimiterResult {
#[inline]
pub fn offset_by(self, offset: usize) -> DelimiterResult {
match self {
DelimiterResult::Found { pos, byte } => DelimiterResult::Found {
pos: pos + offset,
byte,
},
DelimiterResult::NotFound => DelimiterResult::NotFound,
}
}
}
pub mod class {
pub const WHITESPACE: u8 = 0b0000_0001;
pub const ALPHA: u8 = 0b0000_0010;
pub const DIGIT: u8 = 0b0000_0100;
pub const DELIMITER: u8 = 0b0000_1000;
pub const OTHER: u8 = 0b0000_0000;
}
#[derive(Clone, Copy, Debug, Default)]
pub struct AllMasks {
pub lt: u64,
pub gt: u64,
pub quot: u64,
pub apos: u64,
}
#[inline(always)]
pub fn classify_byte(b: u8) -> u8 {
match b {
b' ' | b'\t' | b'\n' | b'\r' => class::WHITESPACE,
b'a'..=b'z' | b'A'..=b'Z' => class::ALPHA,
b'0'..=b'9' => class::DIGIT,
b'<' | b'>' | b'&' | b'"' | b'\'' | b'=' | b'/' => class::DELIMITER,
_ => class::OTHER,
}
}