mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor: remove unstable feature slice_as_chunks (#632)
This commit is contained in:
parent
fbb8aa3338
commit
2203d08199
2 changed files with 26 additions and 27 deletions
|
|
@ -39,23 +39,24 @@ impl SkipWhitespace {
|
|||
}
|
||||
|
||||
pub fn simd(&mut self, bytes: &[u8]) -> &Self {
|
||||
let (chunks, remainder) = bytes.as_chunks::<ELEMENTS>();
|
||||
let chunks = bytes.chunks(ELEMENTS);
|
||||
|
||||
for chunk in chunks {
|
||||
self.check_chunk(chunk);
|
||||
if self.found {
|
||||
return self;
|
||||
if chunk.len() == ELEMENTS {
|
||||
self.check_chunk(chunk);
|
||||
if self.found {
|
||||
return self;
|
||||
}
|
||||
} else {
|
||||
let remainder = chunk;
|
||||
// Align the last chunk for avoiding the use of a scalar version
|
||||
let mut chunk = [0; ELEMENTS];
|
||||
let len = remainder.len();
|
||||
chunk[..len].copy_from_slice(remainder);
|
||||
self.check_chunk(&chunk);
|
||||
}
|
||||
}
|
||||
|
||||
if !remainder.is_empty() {
|
||||
// Align the last chunk for avoiding the use of a scalar version
|
||||
let mut chunk = [0; ELEMENTS];
|
||||
let len = remainder.len();
|
||||
chunk[..len].copy_from_slice(remainder);
|
||||
self.check_chunk(&chunk);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
@ -120,23 +121,22 @@ impl<'a> SkipMultilineComment<'a> {
|
|||
}
|
||||
|
||||
pub fn simd(&mut self) -> &Self {
|
||||
let (chunks, remainder) = self.remaining.as_chunks::<ELEMENTS>();
|
||||
|
||||
for chunk in chunks {
|
||||
self.check(chunk, chunk.len());
|
||||
if self.found {
|
||||
return self;
|
||||
for chunk in self.remaining.chunks(ELEMENTS) {
|
||||
if chunk.len() == ELEMENTS {
|
||||
self.check(chunk, chunk.len());
|
||||
if self.found {
|
||||
return self;
|
||||
}
|
||||
} else {
|
||||
let remainder = chunk;
|
||||
// Align the last chunk for avoiding the use of a scalar version
|
||||
let mut chunk = [0; ELEMENTS];
|
||||
let len = remainder.len();
|
||||
chunk[..len].copy_from_slice(remainder);
|
||||
self.check(&chunk, len);
|
||||
}
|
||||
}
|
||||
|
||||
if !remainder.is_empty() {
|
||||
// Align the last chunk for avoiding the use of a scalar version
|
||||
let mut chunk = [0; ELEMENTS];
|
||||
let len = remainder.len();
|
||||
chunk[..len].copy_from_slice(remainder);
|
||||
self.check(&chunk, len);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@
|
|||
|
||||
#![allow(clippy::wildcard_imports)] // allow for use `oxc_ast::ast::*`
|
||||
#![cfg_attr(not(target_arch = "wasm32"), feature(portable_simd))]
|
||||
#![feature(slice_as_chunks)]
|
||||
|
||||
mod context;
|
||||
mod cursor;
|
||||
|
|
|
|||
Loading…
Reference in a new issue