Skip to content

Commit

Permalink
feat(utf8): support utf8 in path for neon also
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Sep 17, 2024
1 parent df0651e commit a00e411
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/simd/neon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ unsafe fn match_header_name_char_16_neon(ptr: *const u8) -> usize {
offsetz(result) as usize
}

#[cfg(not(feature = "utf8_in_path"))]
#[inline]
unsafe fn match_url_char_16_neon(ptr: *const u8) -> usize {
let input = vld1q_u8(ptr);
Expand All @@ -140,6 +141,21 @@ unsafe fn match_url_char_16_neon(ptr: *const u8) -> usize {
offsetz(result) as usize
}

#[cfg(feature = "utf8_in_path")]
#[inline]
unsafe fn match_url_char_16_neon(ptr: *const u8) -> usize {
let input = vld1q_u8(ptr);

// Check that b'!' <= and b != 127
let result = vcleq_u8(vdupq_n_u8(b'!'), input);

// Disallow del
let del = vceqq_u8(input, vdupq_n_u8(0x7F));
let result = vbicq_u8(result, del);

offsetz(result) as usize
}

#[inline]
unsafe fn match_header_value_char_16_neon(ptr: *const u8) -> usize {
let input = vld1q_u8(ptr);
Expand Down

0 comments on commit a00e411

Please sign in to comment.