Skip to content

Commit

Permalink
update SIMD stubs for new KmerStorage definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-k committed Oct 10, 2024
1 parent 0142370 commit 19668a1
Showing 1 changed file with 20 additions and 27 deletions.
47 changes: 20 additions & 27 deletions bio-seq/src/kmer/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64, 4> {
const BITS: usize = todo!();
impl sealed::KmerStorage for simd::Simd<u64, 4> {
const BITS: usize = 256;
type BaN = Ba<4>;

fn new() -> Self {
fn to_bitarray(self) -> Self::BaN {
todo!()
}
}

impl<A: Codec, const K: usize> Kmer<A, K, simd::Simd<u64, 4>> {
fn from_seq(seq: &SeqSlice<A>) -> Self {
fn from_bitslice(_bs: &Bs) -> Self {
todo!()
}
}

impl<A: Codec, const K: usize> Hash for Kmer<A, K, simd::Simd<u64, 4>> {
fn hash<H: Hasher>(&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<A: Codec, const K: usize> TryFrom<&SeqSlice<A>> for Kmer<A, K, simd::Simd<u64, 4>> {
type Error = ParseBioError;
impl KmerStorage for simd::Simd<u64, 4> {}

fn try_from(seq: &SeqSlice<A>) -> Result<Self, Self::Error> {
impl<A: Codec, const K: usize> Hash for Kmer<A, K, simd::Simd<u64, 4>> {
fn hash<H: Hasher>(&self, _state: &mut H) {
todo!()
}
}

0 comments on commit 19668a1

Please sign in to comment.