From 19668a1801fe2db6ac09b8d70fd8acb2f6543416 Mon Sep 17 00:00:00 2001 From: jeff-k Date: Thu, 10 Oct 2024 17:29:32 +0100 Subject: [PATCH] update SIMD stubs for new KmerStorage definition --- bio-seq/src/kmer/simd.rs | 47 +++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/bio-seq/src/kmer/simd.rs b/bio-seq/src/kmer/simd.rs index bd5b6f0..251d492 100644 --- a/bio-seq/src/kmer/simd.rs +++ b/bio-seq/src/kmer/simd.rs @@ -6,48 +6,41 @@ //! SIMD kmers //! -#![feature(portable_simd)] - use crate::codec::Codec; -use crate::kmer::{Kmer, KmerStorage}; -use crate::prelude::{Complement, ParseBioError, ReverseComplement}; -use crate::seq::{Seq, SeqArray, SeqSlice}; -use crate::{Ba, Bs, Bv}; - -use bitvec::field::BitField; -use bitvec::view::BitView; -use core::fmt; +use crate::kmer::{sealed, Kmer, KmerStorage}; +//use crate::seq::{SeqSlice}; +use crate::{Ba, Bs}; + use core::hash::{Hash, Hasher}; -use core::marker::PhantomData; -use core::ops::Deref; -use core::ptr; -use core::str::FromStr; use std::simd; -impl KmerStorage for simd::Simd { - const BITS: usize = todo!(); +impl sealed::KmerStorage for simd::Simd { + const BITS: usize = 256; + type BaN = Ba<4>; - fn new() -> Self { + fn to_bitarray(self) -> Self::BaN { todo!() } -} -impl Kmer> { - fn from_seq(seq: &SeqSlice) -> Self { + fn from_bitslice(_bs: &Bs) -> Self { todo!() } -} -impl Hash for Kmer> { - fn hash(&self, state: &mut H) { - todo!() + fn mask(&mut self, bits: usize) { + let mask = if bits >= 256 { + simd::u64x4::splat(u64::MAX) + } else { + todo!() + }; + + *self &= mask; } } -impl TryFrom<&SeqSlice> for Kmer> { - type Error = ParseBioError; +impl KmerStorage for simd::Simd {} - fn try_from(seq: &SeqSlice) -> Result { +impl Hash for Kmer> { + fn hash(&self, _state: &mut H) { todo!() } }