From 277d833da228268bbab4026f511c3ef63faab0d4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 5 Apr 2023 22:39:59 +0200 Subject: [PATCH] Add AVX2 Dependency --- schemsearch-lib/Cargo.toml | 3 ++- schemsearch-lib/src/lib.rs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/schemsearch-lib/Cargo.toml b/schemsearch-lib/Cargo.toml index 559e62c..cb926d2 100644 --- a/schemsearch-lib/Cargo.toml +++ b/schemsearch-lib/Cargo.toml @@ -9,4 +9,5 @@ license = "AGPL-3.0-or-later" [dependencies] hematite-nbt = "0.5.2" serde = "1.0.152" -schemsearch-files = { path = "../schemsearch-files" } \ No newline at end of file +schemsearch-files = { path = "../schemsearch-files" } +manual-avx2 = { git = "https://github.com/Chaoscaot/manual-avx2", version = "0.1.0" } diff --git a/schemsearch-lib/src/lib.rs b/schemsearch-lib/src/lib.rs index 98a512e..24de603 100644 --- a/schemsearch-lib/src/lib.rs +++ b/schemsearch-lib/src/lib.rs @@ -88,6 +88,12 @@ pub fn search( } } } + + for index in (0..schem_data.len()).step_by(8) { + let pattern_data_slice = schem_data[index..index + 8]; + let data = manual_avx2::vec_i::VecInteger::new_i32(&(index..index + 8).map(|i| schem_data[i]).collect::<[i32; 8]>()); + } + let matching_percent = matching as f32 / pattern_blocks; if matching_percent >= search_behavior.threshold { matches.push(Match {