Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
chengsun committed May 28, 2022
1 parent 60a31e3 commit c2a3f49
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 54 deletions.
15 changes: 0 additions & 15 deletions src/clmul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,6 @@ mod x86 {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use x86::*;

impl Clmul for Box<dyn Clmul> {
fn clmul(&self, input: u64) -> u64 {
(**self).clmul(input)
}
}

pub fn runtime_detect() -> Box<dyn Clmul> {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
match Sse2Pclmulqdq::new () {
None => (),
Some(clmul) => { return Box::new(clmul); }
}
Box::new(Generic::new())
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
15 changes: 0 additions & 15 deletions src/start_stop_transitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ mod x86 {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use x86::*;

impl StartStopTransitions for Box<dyn StartStopTransitions> {
fn start_stop_transitions(&self, start: u64, stop: u64, prev_state: bool) -> (u64, bool) {
(**self).start_stop_transitions(start, stop, prev_state)
}
}

pub fn runtime_detect() -> Box<dyn StartStopTransitions> {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
match Bmi2::new () {
None => (),
Some(start_stop_transitions) => { return Box::new(start_stop_transitions); }
}
Box::new(Generic::new(clmul::runtime_detect(), xor_masked_adjacent::runtime_detect()))
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions src/structural.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ pub fn make_classifier_cps<'a, Cps: MakeClassifierCps<'a>>(cps: Cps) -> Cps::Ret

#[cfg(test)]
mod tests {
use rand::{prelude::Distribution, SeedableRng};

use super::*;
use crate::utils::*;

Expand Down Expand Up @@ -381,6 +379,8 @@ mod tests {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[test]
fn test_random() {
use rand::{prelude::Distribution, SeedableRng};

let mut rng = rand::rngs::StdRng::seed_from_u64(0);

let chars = b"() \n\"\\a";
Expand Down
6 changes: 0 additions & 6 deletions src/vector_classifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ impl Classifier for GenericClassifier {
}
}

impl Classifier for Box<dyn Classifier> {
fn classify(&self, in_out: &mut [u8]) {
(**self).classify(in_out)
}
}

pub trait ClassifierBuilder {
type Classifier;
fn build(&self, lookup_tables: &LookupTables) -> Self::Classifier;
Expand Down
16 changes: 0 additions & 16 deletions src/xor_masked_adjacent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,6 @@ mod x86 {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use x86::*;

impl XorMaskedAdjacent for Box<dyn XorMaskedAdjacent> {
#[inline(always)]
fn xor_masked_adjacent(&self, bitstring: u64, mask: u64, lo_fill: bool) -> u64 {
(**self).xor_masked_adjacent(bitstring, mask, lo_fill)
}
}

pub fn runtime_detect() -> Box<dyn XorMaskedAdjacent> {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
match Bmi2::new () {
None => (),
Some(xor_masked_adjacent) => { return Box::new(xor_masked_adjacent); }
}
Box::new(Generic::new())
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit c2a3f49

Please sign in to comment.